public ActionResult AddItemServiceMan(ServiceMan serviceMans) { if (!ModelState.IsValid) { return(View(ServiceMans)); } { } if (serviceMans.ServiceManId == 0) { businessLogic = new BusinessLogic(); businessLogic.AddServiceman(serviceMans); } else { var itemInDb = _context.ServiceMans.SingleOrDefault(c => c.ServiceManId == serviceMans.ServiceManId); //create function on busineeslogic itemInDb.ServiceManName = serviceMans.ServiceManName; itemInDb.ServiceAddress = serviceMans.ServiceAddress; itemInDb.ServiceManCellPhoneNo = serviceMans.ServiceManCellPhoneNo; itemInDb.Salary = serviceMans.Salary; itemInDb.JoiningDate = serviceMans.JoiningDate; itemInDb.Designation = serviceMans.Designation; itemInDb.Password = serviceMans.Password; } _context.SaveChanges(); return(RedirectToAction("AddItemServiceMan")); }
public ActionResult Login(ServiceMan serviceMans) { var id = (serviceMans.ServiceManId); Context = new ApplicationDbContext(); bool isvalid = Context.ServiceMans.Any(s => s.ServiceManId == id && s.Password == serviceMans.Password); if (isvalid) { var user = Context.ServiceMans.SingleOrDefault(s => s.ServiceManId == id && s.Password == serviceMans.Password); FormsAuthentication.SetAuthCookie(user.Designation, false); return(RedirectToAction("Index", "Home")); } ViewBag.ErrorMessage = "Id or password Doesn,t Match"; return(RedirectToAction("Login", "Login")); }
public ActionResult Login() { ServiceMan = new ServiceMan(); return(View(ServiceMan)); }
public ActionResult AddItemServiceMan() { ServiceMans = new ServiceMan(); return(View(ServiceMans)); }
public void AddServiceman(ServiceMan Servicemans) { _context = new ApplicationDbContext(); _context.ServiceMans.Add(Servicemans); _context.SaveChanges(); }