public string Register(MyUserAccount account) { try { Customer_Information a = new Customer_Information(); a.Name = account.Name; a.Address = account.Address; a.Phone = int.Parse(account.Phone); a.Email = account.Email; a.Type = account.Type; a.User_id = account.UserName; a.Password = account.Password; Data.Customer_Information.Add(a); Data.SaveChanges(); return(account.Name + " " + " is Successfully Registered"); } catch { return(account.Name + " " + " is Not Registered. Try Again "); } }
public ActionResult Register(MyUserAccount account) { if (ModelState.IsValid) { ModelState.Clear(); ViewBag.Message = Info.Register(account); } return(View()); }
public ActionResult Login(MyUserAccount user) { //if (ModelState.IsValid) //{ // return RedirectToAction("Index", Account.Login(user)); //} using (Hat_Bazar_databaseEntities Data = new Hat_Bazar_databaseEntities()) { try { var usr = Data.Customer_Information.Single(u => u.User_id == user.UserName && u.Password == user.Password); if (usr != null) { Session["Customer_id"] = usr.Customer_id.ToString(); Session["UserName"] = usr.User_id.ToString(); int i = Data.Customer_Order.Count(x => x.Purches_id == usr.Customer_id.ToString() && x.Order_Status == 1); Session["Cart"] = i.ToString(); return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError("", "User Name Or Password is wrong"); } } catch { ModelState.AddModelError("", "User Name Or Password is wrong"); } } //else //{ ModelState.AddModelError("", "User Name Or Password is wrong"); //} return(View()); }
public void CreateAccount_AllowAccountToBePassedIn() { MyUserAccount acct = new MyUserAccount(); var result = subject.CreateAccount("tenant", "user", "pass", "*****@*****.**", null, null, acct); Assert.AreSame(acct, result); }