public HttpResponseMessage CancelFinding(DefectChangeLogsTableRowDto defectChangeLog) { Defect defect = _defectService.FindById(new Guid(defectChangeLog.DefectId)); if (defect != null) { if (defect.IsDeleted == true) { defect.IsDeleted = false; } else { defect.Severity = (Severity)Int32.Parse(defectChangeLog.OriginalSeverity); defect.Name = defectChangeLog.OriginalType; defect.Layer = (DefectLayer)Enum.Parse(typeof(DefectLayer), defectChangeLog.OriginalLayer, true); } var result = _defectService.Update(defect); return(result.Succeeded ? Request.CreateResponse(HttpStatusCode.OK) : Request.CreateErrorResponse(HttpStatusCode.BadRequest, result.Message)); } return(Request.CreateResponse(HttpStatusCode.BadRequest, "Cannot find finding")); }
public HttpResponseMessage EditFinding(DefectChangeLog finding) { Defect defect = _defectService.FindById(finding.Id); List <Guid> defectIds = new List <Guid>(); defectIds.Add(defect.Id); if (defect != null) { defect.Severity = finding.NewSeverity.HasValue ? finding.NewSeverity : finding.OriginalSeverity; defect.Name = finding.NewType.HasValue ? finding.NewType.GetDescription() : finding.OriginalType.GetDescription(); defect.Layer = finding.NewLayer.HasValue ? finding.NewLayer.Value : finding.OriginalLayer; var result = _defectService.Update(defect); _defectService.ChangeDataQualityForSelectedFinding(defectIds); if (result.Succeeded) { finding.DefectId = defect.Id; finding.NewLayer = finding.NewLayer.HasValue ? finding.NewLayer : null; finding.NewSeverity = finding.NewSeverity.HasValue ? finding.NewSeverity : null; finding.NewType = finding.NewType.HasValue ? finding.NewType : null; var url = LocalUrlHelper.GenerateUrlEditedFinding(defect); if (_defectChangeLogService.AddDefectChangeLog(finding).Succeeded) { _defectChangeLogService.Notify(finding, url); } } return(result.Succeeded ? Request.CreateResponse(HttpStatusCode.OK) : Request.CreateErrorResponse(HttpStatusCode.BadRequest, result.Message)); } return(Request.CreateResponse(HttpStatusCode.BadRequest, "Cannot find finding")); }
public FindingsTableRowDto GetFinding(Guid findingId) { Defect defect = _defectService.FindById(findingId); return(_mapper.Map <FindingsTableRowDto>(defect)); }