Example #1
0
        public async Task <AntiSocialBehaviourTypeDto> PostAntiSocialBehaviourType(AntiSocialBehaviourTypeDto model)
        {
            var url    = CRMApiUri + "/AntiSocialBehaviourType";
            var result = await PostRequestToApi(url, model);

            return(result);
        }
Example #2
0
        public async Task <BaseEntity> SaveAndReturnEntityAsync(AntiSocialBehaviourTypeDto entityDto)
        {
            var entity = _mapper.Map <AntiSocialBehaviourType>(entityDto);
            var result = await _repository.SaveAndReturnEntityAsync(entity);

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

            return(result.Id);
        }
Example #7
0
 public async Task <AntiSocialBehaviourTypeDto> PutAntiSocialBehaviourType(int id, AntiSocialBehaviourTypeDto model)
 {
     return(await _antiSocialBehaviourTypeApiClient.PutAntiSocialBehaviourType(id, model));
 }
Example #8
0
 public async Task <AntiSocialBehaviourTypeDto> PostAntiSocialBehaviourType(AntiSocialBehaviourTypeDto model)
 {
     return(await _antiSocialBehaviourTypeApiClient.PostAntiSocialBehaviourType(model));
 }
Example #9
0
        public async Task <AntiSocialBehaviourTypeDto> PutAntiSocialBehaviourType(int id, AntiSocialBehaviourTypeDto model)
        {
            var url    = CRMApiUri + "/AntiSocialBehaviourType/" + id;
            var result = await PutRequestToApi(url, model);

            return(result);
        }