when i tried to run it it faces the error like "
CS0161 C# : not all code paths return a value
" please suggest me the way that it can solve my error[HttpPost]
public ActionResult Create(Student s)
{
if(ModelState.IsValid==true)
{
db.Students.Add(s);
int a = db.SaveChanges();
if (a > 0)
{
//ViewBag.InsertMessage = "";
TempData["InsertMessage"] = "";
return RedirectToAction("Index");
}
else
{
ViewBag.InsertMessage = "";
return View();
}
}
}
Sanwar RanwaPosted Dec 3, 2019, 6:28 AM
Sanwar RanwaPosted Dec 3, 2019, 6:32 AM
NikitaPosted Dec 3, 2019, 6:17 AM
Guest UserPosted Dec 3, 2019, 6:11 AM