Click here to Skip to main content
15,894,720 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is my code for update (edit) datas, which i have send object for edit data, but on this
(if (ModelState.IsValid)) statement i have getting false. and on debugging face i have getting -Result View is - "Expanding the Results View will enumerate the IEnumerable". Actually i am not understanding how can do i.


C#
public string Edit(WrittenExam objTodo)
      {
          string msg;
          try
          {
             if (ModelState.IsValid)
              {
                  db.Entry(objTodo).State = EntityState.Modified;
                  db.SaveChanges();
                  msg = "Saved Successfully";
              }
              else
              {
                  msg = "Validation data not successfull";
              }
          }
          catch (Exception ex)
          {
              msg = "Error occured:" + ex.Message;
          }
          return msg;
      }



This is my Model

C#
public class WrittenExam
  {
      public int id { get; set; }

      public DateTime examdate { get; set; }

      public DateTime year { get; set; }

      public string examopen { get; set; }

      public string applicationfee { get; set; }

      public string writtenfee { get; set; }


  }

Thanks.
Posted
Updated 12-Mar-15 21:08pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900