public async Task <IActionResult> UpdateWorkPackage(int id, [FromBody] ProjectWorkPackageListDto model) { var response = await _clientService.PutAsync($"{_settings.Value.OilApiAddress}WorkPackage/UpdateWorkPackage/{id}", model); var content = await response.Content.ReadAsStringAsync(); return(new ObjectResult(content)); }
public void BizAction(ProjectWorkPackageListDto inputData) { var roadMap = _dbAccess.GetRoadMap(inputData.Id); if (roadMap == null) { throw new NullReferenceException("Could not find the road map. Someone entering illegal ids?"); } var status = roadMap.UpdateRoadMap(inputData.Name); CombineErrors(status); Message = $"road map is update: {roadMap.ToString()}."; }
public WorkPackage BizAction(ProjectWorkPackageListDto inputData) { if (string.IsNullOrWhiteSpace(inputData.Name)) { AddError("Name is Required."); return(null); } var desStatus = WorkPackage.CreateRoadMap(inputData.Name); CombineErrors(desStatus); if (!HasErrors) { _dbAccess.Add(desStatus.Result); } return(HasErrors ? null : desStatus.Result); }
public IActionResult UpdateWorkPackage(int id, [FromBody] ProjectWorkPackageListDto model , [FromServices] IActionService <IUpdateRoadMapAction> service) { model.Id = id; service.RunBizAction(model); if (!service.Status.HasErrors) { return(new ObjectResult(new ResultResponseDto <String, int> { Key = HttpStatusCode.OK, Value = "WorkPackage updated..", Subject = model.Id })); } var errors = service.Status.CopyErrorsToString(ModelState); return(new ObjectResult(new ResultResponseDto <String, int> { Key = HttpStatusCode.BadRequest, Value = errors, Subject = model.Id })); }
public IActionResult CreateWorkPackage([FromBody] ProjectWorkPackageListDto model , [FromServices] IActionService <IPlaceWorkPackageAction> service) { var roadMap = service.RunBizAction <WorkPackage>(model); if (!service.Status.HasErrors) { return(new ObjectResult(new ResultResponseDto <String, int> { Key = HttpStatusCode.OK, Value = "WorkPackage Created...", Subject = roadMap.Id })); } var errors = service.Status.CopyErrorsToString(ModelState); service.Status.CopyErrorsToString(ModelState); return(new ObjectResult(new ResultResponseDto <String, int> { Key = HttpStatusCode.BadRequest, Value = errors })); }