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

            return(result);
        }
Ejemplo n.º 2
0
        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)));
        }
Ejemplo n.º 3
0
        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)));
        }
Ejemplo n.º 4
0
        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 }));
        }
Ejemplo n.º 5
0
        public async Task <int> SaveAsync(AntiSocialBehaviourCaseClosureReasonDto entityDto)
        {
            var result = await SaveAndReturnEntityAsync(entityDto);

            return(result.Id);
        }
Ejemplo n.º 6
0
 public async Task <AntiSocialBehaviourCaseClosureReasonDto> PutAntiSocialBehaviourCaseClosureReason(int id, AntiSocialBehaviourCaseClosureReasonDto model)
 {
     return(await _antiSocialBehaviourCaseClosureReasonApiClient.PutAntiSocialBehaviourCaseClosureReason(id, model));
 }
Ejemplo n.º 7
0
        public async Task <AntiSocialBehaviourCaseClosureReasonDto> PutAntiSocialBehaviourCaseClosureReason(int id, AntiSocialBehaviourCaseClosureReasonDto model)
        {
            var url    = CRMApiUri + "/AntiSocialBehaviourCaseClosureReason/" + id;
            var result = await PutRequestToApi(url, model);

            return(result);
        }