public JsonResult CreateName() { var dto = new DTO(); var siteId = DbUtils.GetSiteidIdForUser(HttpContext.User.Identity.Name); var lastName = Request.Params["LastName"]; var firstName = Request.Params["FirstName"]; var empId = Request.Params["EmpID"]; var email = Request.Params["Email"]; dto.ReturnValue = DbPostTestsUtils.DoesStaffNameExist(lastName, firstName, siteId); if (dto.ReturnValue != 0) { if (dto.ReturnValue == -1) { dto.Message = "There was an error in determinig if this name was already in the database."; } if (dto.ReturnValue == 0) { dto.Message = "This name already exists. Select your name from the drop down list."; } _logger.LogInfo("PostTests.CreateName - message: " + dto.Message + ", name: " + lastName + "," + firstName + ", site: " + siteId.ToString(CultureInfo.InvariantCulture)); return(Json(dto)); } dto.ReturnValue = DbPostTestsUtils.AddNurseStaff(lastName, firstName, empId, siteId, email); var staff = NotificationUtils.GetStaffForEvent(3, siteId); string siteName = DbUtils.GetSiteNameForUser(User.Identity.Name); var u = new UrlHelper(Request.RequestContext); Debug.Assert(Request.Url != null, "Request.Url != null"); var url = "http://" + Request.Url.Host + u.RouteUrl("Default", new { Controller = "Account", Action = "Logon" }); Utility.SendNurseAccountCreatedMail(staff.ToArray(), new[] { Request.Params["Email"] }, firstName + " " + lastName, siteName, empId, Server, url); _logger.LogInfo("PostTests.CreateName - message: " + dto.Message + ", name: " + lastName + "," + firstName + ", site: " + siteId.ToString(CultureInfo.InvariantCulture)); return(Json(dto)); }