Example #1
0
        public async Task <BaseResponse <bool> > CreateReservationProcessingFees(HotelReservationProcessingFeeCreateModel model)
        {
            try
            {
                if (model == null)
                {
                    return(BaseResponse <bool> .BadRequest());
                }

                var checkExistEntity = _db.HotelReservationProcessingFees.Find(model.ReservationsFid);
                if (checkExistEntity == null)
                {
                    var entity = new HotelReservationProcessingFees();
                    entity.InjectFrom(model);
                    entity.GeneratedDate    = DateTime.Now;
                    entity.LastModifiedBy   = GetUserGuidId();
                    entity.LastModifiedDate = DateTime.Now;

                    await _db.HotelReservationProcessingFees.AddAsync(entity);

                    await _db.SaveChangesAsync();

                    return(BaseResponse <bool> .Success(true));
                }
                return(BaseResponse <bool> .NotFound(message : "Duplicated"));
            }
            catch (Exception ex)
            {
                return(BaseResponse <bool> .InternalServerError(message : ex.Message));
            }
        }
        public async Task <IActionResult> CreateReservationProcessingFeesAsync([FromBody] HotelReservationProcessingFeeCreateModel requestModel)
        {
            var response = await _hotelReservationProcessingFeesService.CreateReservationProcessingFees(requestModel);

            return(Ok(response));
        }