public async Task <BaseEntity> SaveAndReturnEntityAsync(AntiSocialBehaviourCaseClosureReasonDto entityDto) { var entity = _mapper.Map <AntiSocialBehaviourCaseClosureReason>(entityDto); var result = await _repository.SaveAndReturnEntityAsync(entity); return(result); }
public async Task <IActionResult> Put(int id, [FromBody] AntiSocialBehaviourCaseClosureReasonDto antiSocialBehaviourCaseClosureReason) { if (id == 0 || antiSocialBehaviourCaseClosureReason.Id == 0) { return(StatusCode(StatusCodes.Status400BadRequest, "Id needs to be greater than 0.")); } return(await SaveAndReturnEntityAsync(async() => await _antiSocialBehaviourCaseClosureReasonService.SaveAndReturnEntityAsync(antiSocialBehaviourCaseClosureReason))); }
public async Task <IActionResult> Post([FromBody] AntiSocialBehaviourCaseClosureReasonDto antiSocialBehaviourCaseClosureReason) { if (antiSocialBehaviourCaseClosureReason.Id != 0) { return(StatusCode(StatusCodes.Status400BadRequest, "Identity insert is not permitted.")); } return(await SaveAndReturnEntityAsync(async() => await _antiSocialBehaviourCaseClosureReasonService.SaveAndReturnEntityAsync(antiSocialBehaviourCaseClosureReason))); }
public IActionResult Save(AntiSocialBehaviourCaseClosureReasonDto model) { UpdateAuditInformation(model); if (!ModelState.IsValid) { GetStateSettings(ViewState.Write); return(PartialView("Edit", model)); } model = model.Id > 0 ? _lookupFacadeApiClient.PutAntiSocialBehaviourCaseClosureReason(model.Id, model).Result : _lookupFacadeApiClient.PostAntiSocialBehaviourCaseClosureReason(model).Result; if (!string.IsNullOrWhiteSpace(model.ErrorMessage)) { return(PartialView("Edit", model)); } return(Json(new { message = model.SuccessMessage })); }
public async Task <int> SaveAsync(AntiSocialBehaviourCaseClosureReasonDto entityDto) { var result = await SaveAndReturnEntityAsync(entityDto); return(result.Id); }
public async Task <AntiSocialBehaviourCaseClosureReasonDto> PutAntiSocialBehaviourCaseClosureReason(int id, AntiSocialBehaviourCaseClosureReasonDto model) { return(await _antiSocialBehaviourCaseClosureReasonApiClient.PutAntiSocialBehaviourCaseClosureReason(id, model)); }
public async Task <AntiSocialBehaviourCaseClosureReasonDto> PutAntiSocialBehaviourCaseClosureReason(int id, AntiSocialBehaviourCaseClosureReasonDto model) { var url = CRMApiUri + "/AntiSocialBehaviourCaseClosureReason/" + id; var result = await PutRequestToApi(url, model); return(result); }