Esempio n. 1
0
        public ActionResult <string> Get(decimal firstPassenger, decimal secondPassenger)
        {
            var result = _test.IsThereDiscount(new CruiseDTO()
            {
                PassengerCruise = new List <PassengerCruiseDTO>()
                {
                    new PassengerCruiseDTO()
                    {
                        PassengerCode = "1", Cruise = new CruiseDTO()
                        {
                            CabinValue = firstPassenger
                        }
                    },
                    new PassengerCruiseDTO()
                    {
                        PassengerCode = "2", Cruise = new CruiseDTO()
                        {
                            CabinValue = secondPassenger
                        }
                    },
                },
                CabinValue = firstPassenger + secondPassenger
            });

            return(new JsonResult(result));
        }
        //public bool? IsThereDiscount([FromBody]CruiseDTO cruiseDTO)
        public bool?IsThereDiscount([FromBody] CruiseDTO cruiseDTO)
        {
            //string json = jarray.ToString();
            //CruiseDTO cruiseDTO = JsonConvert.DeserializeObject<CruiseDTO>(json);

            return(_logicTest.IsThereDiscount(cruiseDTO));
        }
Esempio n. 3
0
        public bool?IsThereDiscount(PassengerCruiseModel request)
        {
            List <PassengerCruiseDTO> passengerCruise = new List <PassengerCruiseDTO>();
            decimal cabinValue = 0;

            foreach (var item in request.PassengerCruise)
            {
                passengerCruise.Add(
                    new PassengerCruiseDTO()
                {
                    PassengerCode = item.PassengerCode, Cruise = new CruiseDTO()
                    {
                        CabinValue = item.CabinValue
                    }
                }
                    );
                cabinValue += item.CabinValue;
            }

            var cruise = new CruiseDTO()
            {
                PassengerCruise = passengerCruise,
                CabinValue      = cabinValue
            };

            return(_simpleLogicTest.IsThereDiscount(cruise));
        }
Esempio n. 4
0
 public bool?Discount(decimal firstPassenger, decimal secondPassenger)
 {
     return(_test.IsThereDiscount(new CruiseDTO()
     {
         PassengerCruise = new List <PassengerCruiseDTO>()
         {
             new PassengerCruiseDTO()
             {
                 PassengerCode = "1", Cruise = new CruiseDTO()
                 {
                     CabinValue = firstPassenger
                 }
             },
             new PassengerCruiseDTO()
             {
                 PassengerCode = "2", Cruise = new CruiseDTO()
                 {
                     CabinValue = secondPassenger
                 }
             },
         },
         CabinValue = firstPassenger + secondPassenger
     }));
 }
Esempio n. 5
0
 public bool?IsThereDiscount(CruiseDTO cruise)
 {
     return(_simpleLogicTest.IsThereDiscount(cruise));
 }