While I am trying to insert values into the database in asp.net mvc4
with entity framework, it is throwing an exception. Help me to solve this exception.
The error message is: An error occurred while updating the entries. See the inner exception for details
.
This is my code in controller
{
[HttpPost]
public ActionResult rated(FormCollection form)
{
int ratedvalue = Convert.ToInt32(form["rating"]);
using (var db = new FSLIndiaLatest.Models.FSLWebEntitiesContext())
{
var value = new FSLIndiaLatest.Models.Tbl_Rating();
value.Rating = Convert.ToInt32(ratedvalue);
value.CreatedOn = DateTime.Now;
value.CreatedBy = 2;
db.Tbl_Rating.Add(value);
db.SaveChanges();
return View(form);
}
}
}