Example #1
0
        public DatabaseServiceFake()
        {
            _houseTypes = new List <HouseTypeModel> {
                new HouseTypeModel()
                {
                    Id = 0, Name = "Apartment", MultiplyPriceBy = 1
                },
                new HouseTypeModel()
                {
                    Id = 1, Name = "Bungalow", MultiplyPriceBy = 1.5M
                },
            };

            _reservations = new List <ReservationModel> {
                new ReservationModel()
                {
                    Id = 0, HouseType = 0, Email = "*****@*****.**", Price = 80
                },
                new ReservationModel()
                {
                    Id = 1, HouseType = 1, Email = "*****@*****.**", Price = 120
                },
            };


            _baseDayFeeModel = new BaseDayFeeModel {
                Id = 1, Price = 70
            };
        }
        public BaseDayFeeModel AddUpdateBaseDayFee(BaseDayFeeModel baseDayFee)
        {
            var baseDayFeeTable = _db.GetCollection <BaseDayFeeModel>("BaseDayFee");

            var hasbaseDayFee = baseDayFeeTable.FindOne(x => x.Id == baseDayFee.Id) != null;

            if (!hasbaseDayFee)
            {
                var result = baseDayFeeTable.Insert(baseDayFee);
                baseDayFee.Id     = result;
                currentBaseDayFee = baseDayFee.Price;
            }
            else
            {
                baseDayFeeTable.Update(baseDayFee);
                currentBaseDayFee = baseDayFee.Price;
            }

            return(baseDayFee);
        }
Example #3
0
 public BaseDayFeeModel AddUpdateBaseDayFee(BaseDayFeeModel baseDayFee)
 {
     throw new NotImplementedException();
 }
        public ActionResult <BaseDayFeeModel> AddUpdateBaseDayFee([FromBody] BaseDayFeeModel model)
        {
            var baseDayFee = _dbService.AddUpdateBaseDayFee(model);

            return(Ok(baseDayFee));
        }