public ActionResult Register(User_Profile UP) { if (ModelState.IsValid) { using (AztecDatabaseEntities ad = new AztecDatabaseEntities()) { ad.User_Profile.Add(UP); ad.SaveChanges(); ModelState.Clear(); UP = null; ViewBag.Message = "Successfully Register !"; } } return(View(UP)); }
public ActionResult Login(User_Profile log) { if (ModelState.IsValid) { using (AztecDatabaseEntities adb = new AztecDatabaseEntities()) { var obj = adb.User_Profile.Where(a => a.UserName.Equals(log.UserName) && a.Password.Equals(log.Password)).FirstOrDefault(); if (obj != null) { Session["UserName"] = obj.UserName.ToString(); Session["Password"] = obj.Password.ToString(); return(RedirectToAction("Index")); } } } return(View(log)); }