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

            return(result);
        }
Exemple #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)));
        }
Exemple #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)));
        }
Exemple #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 }));
        }
Exemple #5
0
        public async Task <int> SaveAsync(AntiSocialBehaviourCaseStatusDto entityDto)
        {
            var result = await SaveAndReturnEntityAsync(entityDto);

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

            return(result);
        }