Exemplo n.º 1
0
        public async Task <BaseEntity> SaveAndReturnEntityAsync(AntiSocialBehaviourCaseStatusDto entityDto)
        {
            var entity = _mapper.Map <AntiSocialBehaviourCaseStatus>(entityDto);
            var result = await _repository.SaveAndReturnEntityAsync(entity);

            return(result);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Put(int id, [FromBody] AntiSocialBehaviourCaseStatusDto antiSocialBehaviourCaseStatus)
        {
            if (id == 0 || antiSocialBehaviourCaseStatus.Id == 0)
            {
                return(StatusCode(StatusCodes.Status400BadRequest, "Id needs to be greater than 0."));
            }

            return(await SaveAndReturnEntityAsync(async() => await _antiSocialBehaviourCaseStatusService.SaveAndReturnEntityAsync(antiSocialBehaviourCaseStatus)));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Post([FromBody] AntiSocialBehaviourCaseStatusDto antiSocialBehaviourCaseStatus)
        {
            if (antiSocialBehaviourCaseStatus.Id != 0)
            {
                return(StatusCode(StatusCodes.Status400BadRequest, "Identity insert is not permitted."));
            }

            return(await SaveAndReturnEntityAsync(async() => await _antiSocialBehaviourCaseStatusService.SaveAndReturnEntityAsync(antiSocialBehaviourCaseStatus)));
        }
Exemplo n.º 4
0
        public IActionResult Save(AntiSocialBehaviourCaseStatusDto model)
        {
            UpdateAuditInformation(model);
            if (!ModelState.IsValid)
            {
                GetStateSettings(ViewState.Write);
                return(PartialView("Edit", model));
            }
            model = model.Id > 0
                ? _lookupFacadeApiClient.PutAntiSocialBehaviourCaseStatus(model.Id, model).Result
                : _lookupFacadeApiClient.PostAntiSocialBehaviourCaseStatus(model).Result;

            if (!string.IsNullOrWhiteSpace(model.ErrorMessage))
            {
                return(PartialView("Edit", model));
            }
            return(Json(new { message = model.SuccessMessage }));
        }
Exemplo n.º 5
0
        public async Task <int> SaveAsync(AntiSocialBehaviourCaseStatusDto entityDto)
        {
            var result = await SaveAndReturnEntityAsync(entityDto);

            return(result.Id);
        }
Exemplo n.º 6
0
 public async Task <AntiSocialBehaviourCaseStatusDto> PutAntiSocialBehaviourCaseStatus(int id, AntiSocialBehaviourCaseStatusDto model)
 {
     return(await _antiSocialBehaviourCaseStatusApiClient.PutAntiSocialBehaviourCaseStatus(id, model));
 }
Exemplo n.º 7
0
 public async Task <AntiSocialBehaviourCaseStatusDto> PostAntiSocialBehaviourCaseStatus(AntiSocialBehaviourCaseStatusDto model)
 {
     return(await _antiSocialBehaviourCaseStatusApiClient.PostAntiSocialBehaviourCaseStatus(model));
 }
Exemplo n.º 8
0
        public async Task <AntiSocialBehaviourCaseStatusDto> PutAntiSocialBehaviourCaseStatus(int id, AntiSocialBehaviourCaseStatusDto model)
        {
            var url    = CRMApiUri + "/AntiSocialBehaviourCaseStatus/" + id;
            var result = await PutRequestToApi(url, model);

            return(result);
        }