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