Ejemplo n.º 1
0
        public BackEnd.Controllers.Response.HotelResponse AgendarHotel(BackEnd.Controllers.Request.HotelRequest request)
        {
            Models.TbHotel tbHotel = new Models.TbHotel();

            tbHotel.IdCliente  = request.IdCliente;
            tbHotel.IdPet      = request.IdPet;
            tbHotel.DsDelivery = request.Delivery;
            tbHotel.DsLocal    = request.Local;
            tbHotel.DtEntrada  = request.DataEntrada;
            tbHotel.DtSaida    = request.DataSaida;

            ctx.Add(tbHotel);
            ctx.SaveChanges();

            BackEnd.Controllers.Response.HotelResponse response = new BackEnd.Controllers.Response.HotelResponse();

            response.IdCliente   = request.IdCliente;
            response.IdPet       = request.IdPet;
            response.Delivery    = request.Delivery;
            response.Local       = request.Local;
            response.DataEntrada = request.DataEntrada;
            response.DataSaida   = request.DataSaida;

            return(response);
        }
Ejemplo n.º 2
0
        public BackEnd.Controllers.Response.HotelResponse AgendarHospedagem(BackEnd.Controllers.Request.HotelRequest request)
        {
            Database.HotelDatabase database = new Database.HotelDatabase();

            if (string.IsNullOrEmpty(request.Local))
            {
                throw new Exception("Ocorreu um erro com o Local");
            }

            BackEnd.Controllers.Response.HotelResponse response = database.AgendarHotel(request);

            return(response);
        }
        public ActionResult <BackEnd.Controllers.Response.HotelResponse> AgendarHotel(BackEnd.Controllers.Request.HotelRequest request)
        {
            try
            {
                Business.AgendamentoHotelBusiness business = new Business.AgendamentoHotelBusiness();

                BackEnd.Controllers.Response.HotelResponse response = business.AgendarHospedagem(request);

                return(response);
            }
            catch (System.Exception ex)
            {
                return(new BadRequestObjectResult(
                           new BackEnd.Controllers.Response.ErroResponse(ex, 400)
                           ));
            }
        }