public async Task <ActionResult> SignIn(FormCollection collection) { var account = collection["Account"]; var password = collection["Password"]; USER user = await db.USERs.SingleOrDefaultAsync(f => f.UserName == account && f.Password == password); if (user != null) { return(RedirectToAction("Product", "Admin")); } else { CLIENTACCOUNT client = await db.CLIENTACCOUNTs.SingleOrDefaultAsync(f => f.AccountName == account && f.PassWord == password); if (client != null) { Session["Client"] = client.ClientName; Session[client.ClientName.ToString().Trim()] = client.Id; return(RedirectToAction("Index", "Product")); } else { return(View()); } } }
public async Task <ActionResult> Register(CLIENTACCOUNT cLIENTACCOUNT) { if (ModelState.IsValid) { db.CLIENTACCOUNTs.Add(cLIENTACCOUNT); await db.SaveChangesAsync(); return(RedirectToAction("Index", "Product")); } return(View(cLIENTACCOUNT)); }
public ActionResult InfoUser(int?idUser) { var onLogin = Session["Client"]; if (idUser == null) { return(RedirectToAction("Index", "Product")); } else { if (onLogin != null) { CLIENTACCOUNT model = db.CLIENTACCOUNTs.Find(idUser); return(View(model)); } else { return(RedirectToAction("Index", "Product")); } } }