TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nikita
NA
56
10.1k
asp.net mvc . my program is not working .please solve my err
Dec 3 2019 5:58 AM
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 = "<script>alert('Dta Inserted Successfully...!!!')</script>";
TempData["InsertMessage"] = "<script>alert('Dta Inserted Successfully...!!!')</script>";
return RedirectToAction("Index");
}
else
{
ViewBag.InsertMessage = "<script>alert('Dta Not Inserted Successfully...!!!')</script>";
return View();
}
}
}
Reply
Answers (
4
)
I Have Some Code But Its Not Working Please Help Me
Email already exist