// This is used to update/add technician, the only differenct is that if it is a create, the userName will be null public ActionResult AddUpdateTech(AdmUserViewModel model, string userId) { string result = _ticketAdapter.AddUpdateUser(model, userId); if (result == "NewOk") { TimeLineHelper.UserOperations(model.FirstName + model.LastName, User.Identity.Name, TimeLineHelper.Operations.Edit); } else if (result == "EditOk") { TimeLineHelper.UserOperations(model.FirstName + model.LastName, User.Identity.Name, TimeLineHelper.Operations.New); } else { TimeLineHelper.ErrorOperations(User.Identity.Name, TimeLineHelper.Operations.Edit, result); } return(RedirectToAction("Users", new { role = model.Role })); }
public ActionResult DeleteTech(string userId) { string userRole = _ticketAdapter.GetUserRole(userId); string result = _ticketAdapter.DeleteUser(userId); if (result == "ok") { TimeLineHelper.UserOperations(userId, User.Identity.Name, TimeLineHelper.Operations.Delete); } else { TimeLineHelper.ErrorOperations(User.Identity.Name, TimeLineHelper.Operations.Edit, result); } if (userRole != null) { return(RedirectToAction("Users", new { role = userRole })); } else { return(RedirectToAction("Users", new { role = "All" })); } }