public ActionResult AuditorCreate(AUDITOR auditor) { try { if (ModelState.IsValid) { auditor.Id = Guid.NewGuid(); auditor.Maker = User.Identity.GetUserName(); auditor.Osysdate = System.DateTime.Now; auditor.State = MyEnums.StatusOptions.Added; _repository.SaveNew(auditor); _sharedCls.LogAudit(User.Identity.GetUserName(), "Created", Request.UserHostName, "Created Auditor" + auditor.AuditorName, "Created", "AuditLetters"); } return RedirectToAction("AuditorIndex"); } catch (Exception ex) { _logs.LogError(User.Identity.GetUserName(), "RegisterUser", "Error: " + ex.Message, Request.ServerVariables["REMOTE_ADDR"], HttpContext.Server.MapPath("."), "AuditLetters"); return View(); } }
public ActionResult AuditorEdit(AUDITOR auditor) { try { if (ModelState.IsValid) { AUDITOR newAuditor = _repository.Find<AUDITOR>(auditor.Id); newAuditor.AuditorName = auditor.AuditorName; newAuditor.Maker = User.Identity.GetUserName(); newAuditor.State = MyEnums.StatusOptions.Added; _repository.SaveUpdate(newAuditor); _sharedCls.LogAudit(User.Identity.GetUserName(), "Edited", Request.UserHostName, "Edited Auditor" + auditor.AuditorName, "Edited", "AuditLetters"); } return RedirectToAction("AuditorIndex"); } catch { return View(); } }