public partial class User { public int ID { get; set; } public string FullName { get; set; } public string UserName { get; set; } public string Email { get; set; } public string Password { get; set; } public string SecurityQuestion { get; set; } public string SecurityAnswer { get; set; } public string Imgurl { get; set; } public int PhoneNo { get; set; } public int RolesId { get; set; } public virtual Role Role { get; set; } }
public ActionResult Registration( User user) { if (ModelState.IsValid) { if (Request.Files != null) { foreach (string item in Request.Files) { HttpPostedFileBase file = Request.Files[item]; string url = "/Images/" + file.FileName; file.SaveAs(Request.MapPath(url)); user.Imgurl = url; } } db.Users.Add(user); db.SaveChanges(); return RedirectToAction("Admin"); } ViewBag.RolesId = new SelectList(db.Roles, "ID", "Name", user.RolesId); return View(user); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)