public ActionResult Create(CustomerVM customerVM) { if (ModelState.IsValid) { var user = CustomerVM.addCustomer(bussinseContext, customerVM); if (user == null) { ViewBag.LoginError = true; ViewBag.Message = "UserName or password is incorrect"; } if (user != null) { HttpContext.Session.SetInt32("CurrentUserId", user.id); HttpContext.Session.SetString("UserName", user.userName); HttpContext.Session.SetInt32("UserRole", user.role.Value); } return(RedirectToAction("Index", "Home", new { area = "" })); } return(View(customerVM)); }