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)); }
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)); }
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 })); }
public bool?IsThereDiscount(CruiseDTO cruise) { return(_simpleLogicTest.IsThereDiscount(cruise)); }