public JsonResult EditRisk([FromBody] RiskAssessmentView model) { if (string.IsNullOrEmpty(model.RiskAssessmentID.ToString())) { return(Json("Fail")); } _riskAssessmentRepository.EditRiskAsync(model); return(Json("success")); }
public async Task <ActionResult> DeleteRisk(string RiskAssessmentID) { if (!string.IsNullOrEmpty(RiskAssessmentID)) { RiskAssessmentView riskAssessment = await _riskAssessmentRepository.FindByIdAsync(RiskAssessmentID); if (riskAssessment != null) { return(PartialView("DeleteRiskAssessment", riskAssessment)); } } return(PartialView("DeleteRiskAssessment")); }
public async Task <JsonResult> DeleteRisk([FromBody] RiskAssessmentView model) { if (!string.IsNullOrEmpty(model.RiskAssessmentID.ToString())) { RiskAssessmentView riskAssessment = await _riskAssessmentRepository.FindByIdAsync(model.RiskAssessmentID.ToString()); if (riskAssessment != null) { OperationResult result = await _riskAssessmentRepository.DeleteRiskAssessmentAsync(riskAssessment); if (result.Succeeded) { return(Json("Success")); } } } return(Json("Failed")); }
public Task <OperationResult> DeleteRiskAssessmentAsync(RiskAssessmentView data) { DynamicParameters param = new DynamicParameters(); param.Add("RiskAssessmentID", data.RiskAssessmentID); param.Add("RetVal", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue); _sqlConnection.Execute("DeleteRiskAssessment", param, commandType: CommandType.StoredProcedure); int rowsAdded = param.Get <int>("RetVal"); return(Task.FromResult(rowsAdded.Equals(1) ? OperationResult.Success : OperationResult.Failed(new OperationResultError { Code = string.Empty, Description = $"The data your trying to delete have an error please try again." }))); }
public Task <OperationResult> EditRiskAsync(RiskAssessmentView data) { #region parameters DynamicParameters param = new DynamicParameters(); param.Add("RiskAssessmentID", data.RiskAssessmentID); param.Add("SubjectTitle", data.SubjectTitle); param.Add("Organization", data.Organization); param.Add("DocumentNo", data.DocumentNo); param.Add("Owner", data.Owner); param.Add("ApproveBy", data.ApprovedBy); param.Add("EntryDate", data.EntryDate); param.Add("RevisionNo", data.RevisionNo); param.Add("SurveyorName", data.SurveyorName); param.Add("SurveyorNumber", data.SurveyorTelephone); param.Add("SurveyorEmail", data.SurveyorEmail); param.Add("SurveyDate", data.SurveyDate); param.Add("SiteName", data.SiteName); param.Add("Country", data.SiteCountry); param.Add("Address", data.SiteAdress); param.Add("ProvinceState", data.SiteStateProvince); param.Add("PrimaryContactName", data.ContactPersonName); param.Add("PhoneNumber", data.ContactPersonTelephone); param.Add("FaxNumber", data.ContactPersonFaxNumber); param.Add("EmailAdress", data.ContactPersonEmail); param.Add("URLAdress", data.ContactPersonWebsiteUrl); param.Add("RetVal", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue); #endregion _sqlConnection.Execute("EditRiskAssessment", param, commandType: CommandType.StoredProcedure); int rowsAdded = param.Get <int>("RetVal"); return(Task.FromResult(rowsAdded.Equals(1) ? OperationResult.Success : OperationResult.Failed(new OperationResultError { Code = string.Empty, Description = $"The data your trying to update have an error please try again." }))); }
public async Task <IActionResult> EditRisk(string RiskAssessmentID) { if (string.IsNullOrEmpty(RiskAssessmentID)) { return(PartialView("GetRiskAssessment")); } RiskAssessmentView riskAssessment = await _riskAssessmentRepository.FindByIdAsync(RiskAssessmentID); if (riskAssessment != null) { riskAssessment.SiteCountry = riskAssessment.Country; riskAssessment.SiteAdress = riskAssessment.Address; riskAssessment.SiteStateProvince = riskAssessment.ProvinceState; riskAssessment.SurveyorTelephone = riskAssessment.SurveyorNumber; riskAssessment.ContactPersonName = riskAssessment.PrimaryContactName; riskAssessment.ContactPersonTelephone = riskAssessment.PhoneNumber; riskAssessment.ContactPersonFaxNumber = riskAssessment.FaxNumber; riskAssessment.ContactPersonEmail = riskAssessment.EmailAdress; riskAssessment.ContactPersonWebsiteUrl = riskAssessment.URLAdress; return(PartialView("EditRisk", riskAssessment)); } return(PartialView("GetRiskAssessment")); }
public JsonResult AddRisk([FromBody] RiskAssessmentView model) { _riskAssessmentRepository.AddRiskAsync(model); return(Json("success")); }
public ActionResult AddRisk() { RiskAssessmentView model = new RiskAssessmentView(); return(PartialView("AddNewRisk", model)); }