asp.net mvc 4 - An error occurred while updating the entries. See the inner exception for details. ASP.NE MVC 4 with Entity Framework -


I am trying to insert the value into the database using the entity framework. This is displaying an error:

Exception :: An error occurred while updating entries: See internal exceptions for details.

Internal Exception: The specified value for the identity column can not be inserted in the table 'Tbl_Rating' set to close IDENTITY_INSERT

This is my controller Code

  Public Action Rating Rated (Formalion Form) {Int RateValue = Convert. ToInt32 (Form ["Rating"]); (Var db = new Project.Models.EntitiesContext ()) using {var value = new Project.Models.Tbl_Rating (); Value.Rating = Convert. ToInt32 (rating); value. Ready = Date time.Now; Values. Ready = 1; Db.Tbl_Rating.Add (value); Db.SaveChanges (); // Error Point) See Return (form); }}  

This is my model {

  public partial square Tbl_Rating {[Key] Public int rateID {get; Set; } Public taps qualified & lt; Int & gt; Rating {get; Set; } Public string comment {get; Set; } [External ("Tbl_Tasks")] Public Nullable & lt; Int & gt; Get Task ID { Set; } [External ("Tbl_Users")] Public Nullable & lt; Int & gt; UserId {get; Set; } [External ("TBD Delirport")] Public Taps Affordable & lt; Int & gt; DReportID {Receive; Set; } [Required] Public int created {received; Set; } [Required] [datatype (datatype.detime)] public system Datetime Created {at; Set; } Public taps qualified & lt; Int & gt; Modify {receive; Set; } Public taps qualified & lt; System.DateTime & gt; ModifiedOn {get; Set; } Public Virtual Tbl_DailyReport Tbl_DailyReport {get; Set; } Public Virtual Tbl_Tasks Tbl_Tasks {get; Set; } Public Virtual Tbl_Users Tbl_Users {get; Set; }}  

}


Comments