public async Task <BaseResponse <bool> > CreateYachtCharteringProcessingFees(YachtCharteringProcessingFeesCreateModel model)
        {
            try
            {
                if (model == null)
                {
                    return(BaseResponse <bool> .BadRequest());
                }

                var checkExistEntity = _context.YachtCharteringProcessingFees.Find(model.CharteringId);
                if (checkExistEntity == null)
                {
                    var entity = new YachtCharteringProcessingFees();
                    entity.InjectFrom(model);
                    entity.GeneratedDate    = DateTime.Now;
                    entity.LastModifiedBy   = GetUserGuidId();
                    entity.LastModifiedDate = DateTime.Now;

                    await _context.YachtCharteringProcessingFees.AddAsync(entity);

                    await _context.SaveChangesAsync();

                    return(BaseResponse <bool> .Success(true));
                }
                else
                {
                    return(BaseResponse <bool> .NotFound(message : "Duplicated"));
                }
            }
            catch (Exception ex)
            {
                return(BaseResponse <bool> .InternalServerError(message : ex.Message));
            }
        }
示例#2
0
        public async Task <IActionResult> CreateYachtCharteringProcessingFeesAsync([FromBody] YachtCharteringProcessingFeesCreateModel requestModel)
        {
            var result = await _yachtCharteringProcessingFeesService.CreateYachtCharteringProcessingFees(requestModel);

            if (result.IsSuccessStatusCode)
            {
                return(Ok(result));
            }
            return(BadRequest());
        }