[HttpPost]
public ActionResult stdregister(Student s,HttpPostedFileBase pic)
{
int result = db.Students.Where(x => x.student_email ==s.student_email).Count();
if (result == 1)
{
ViewBag.message = "This Email is already Registered. Please enter new Email.";
return View();
}
else
{
if (pic == null)
{
s.student_pic= "~/content/pics/blank-profile-picture-973460_640.png";
}
else
{
string fullpath = Server.MapPath("~/content/pics/" + pic.FileName);
pic.SaveAs(fullpath);
s.student_pic = "~/content/pics/" + pic.FileName;
}
db.Students.Add(s);
db.SaveChanges();
Session["studentloging"] = s;
return RedirectToAction("index");
}
}