public ActionResult Edit([Bind(Include = "StaffId,StaffName,StaffPassword,StaffEmail,StaffContactNumber,StaffDesignation,StaffExperience,IsActive,Cretedby,Modifiedby,Creteddate,Modifieddate")] StaffManage staffManage) { if (ModelState.IsValid) { try { var ModifiedName = Convert.ToString(Session["AdminName"]); staffManage.Modifiedby = ModifiedName; staffManage.Modifieddate = DateTime.Now; if (Session["SId"] == null) { staffManage.IsActive = false; } else if (Session["SId"] != null) { staffManage.IsActive = true; } db.Entry(staffManage).State = EntityState.Modified; db.SaveChanges(); TempData["msg"] = "Staff Details Updated!!"; return(RedirectToAction("Index")); } catch (Exception ex) { TempData["err"] = ex.Message; } } return(View(staffManage)); }
// GET: Admin/StaffManages/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(RedirectToAction("Error", "Dashboard", new { err = "Id is not Avalible!!" })); } StaffManage staffManage = db.StaffManages.Find(id); if (staffManage == null) { return(RedirectToAction("Error", "Dashboard", new { err = "Data is not Avalible!!" })); } return(View(staffManage)); }
public ActionResult DeleteConfirmed(int id) { try { StaffManage staffManage = db.StaffManages.Find(id); db.StaffManages.Remove(staffManage); db.SaveChanges(); TempData["msg"] = "Staff Details Delete !!"; } catch (Exception ex) { TempData["err"] = ex.Message; } return(RedirectToAction("Index")); }
public ActionResult Stafflogin(StaffManage staffManage) { try { var login = db.StaffManages.SingleOrDefault(a => a.StaffEmail == staffManage.StaffEmail && a.StaffPassword == staffManage.StaffPassword); if (login != null) { Session["SId"] = staffManage.StaffId; Session["SName"] = staffManage.StaffName; return(RedirectToAction("Index", "Index")); } else { TempData["err"] = "User name or Password is wrong!!"; } } catch (Exception ex) { TempData["err"] = ex.Message; } return(View()); }
public ActionResult Create([Bind(Include = "StaffId,StaffName,StaffPassword,StaffEmail,StaffContactNumber,StaffDesignation,StaffExperience,IsActive,Cretedby,Modifiedby,Creteddate,Modifieddate")] StaffManage staffManage) { if (ModelState.IsValid) { try { var CretedName = Convert.ToString(Session["AdminName"]); staffManage.Cretedby = CretedName; staffManage.Creteddate = DateTime.Now; db.StaffManages.Add(staffManage); db.SaveChanges(); TempData["msg"] = "Staff Details Save!!"; return(RedirectToAction("Index")); } catch (Exception ex) { TempData["err"] = ex.Message; } } return(View(staffManage)); }