public static void CreateOrder(DTO.OrderDTO orderDTO) { if (orderDTO.Name.Trim().Length == 0) { throw new Exception("Name is Required"); } if (orderDTO.Address.Trim().Length == 0) { throw new Exception("address is Required"); } if (orderDTO.Zip.Trim().Length == 0) { throw new Exception("Zip Code is Required"); } if (orderDTO.Phone.Trim().Length == 0) { throw new Exception("Phone Number is Required"); } orderDTO.OrderId = Guid.NewGuid(); orderDTO.TotalCost = PizzaPriceManager.CalculatePizzaCost(orderDTO); Persistence.OrderRepository.CreateOrder(orderDTO); }
public static void CreateOrder(DTOOrder dTOOrder) { //Validation if (dTOOrder.Name.Trim().Length == 0) { throw new Exception("Name is required."); } if (dTOOrder.Address.Trim().Length == 0) { throw new Exception("Address is required."); } if (dTOOrder.Zip.Trim().Length == 0) { throw new Exception("Zip is required."); } if (dTOOrder.Phone.Trim().Length == 0) { throw new Exception("Phone is required."); } dTOOrder.OrderId = Guid.NewGuid(); dTOOrder.TotalCost = PizzaPriceManager.CalculateCost(dTOOrder); Persistence.OrdersRepository.CreateOrder(dTOOrder); }
public static void CreateOrder(DTO.OrderDTO orderDTO) { orderDTO.OrderId = Guid.NewGuid(); orderDTO.TotalCost = PizzaPriceManager.CalculateCost(orderDTO); Persistence.OrderRepository.CreateOrder(orderDTO); }
public static void CreateOrder(DTO.OrderDTO orderDTO) { // Validation if (orderDTO.Name.Trim().Length == 0) { throw new Exception("Please enter a name."); } if (orderDTO.Address.Trim().Length == 0) { throw new Exception("Please enter an address"); } if (orderDTO.Zip.Trim().Length == 0) { throw new Exception("please enter a zip code."); } if (orderDTO.Phone.Trim().Length == 0) { throw new Exception("Please enter a phone number."); } orderDTO.OrderId = Guid.NewGuid(); orderDTO.TotalCost = PizzaPriceManager.CalculateCost(orderDTO); Persistence.OrderRepository.CreateOrder(orderDTO); }
public static void CreateOrder(DTO.Order dtoOrder) { if (dtoOrder.Name.Trim().Length == 0) { throw new Exception("Name is required."); } if (dtoOrder.Address.Trim().Length == 0) { throw new Exception("Address is required."); } if (dtoOrder.Zip.Trim().Length == 0) { throw new Exception("Zip code is required."); } if (dtoOrder.Phone.Trim().Length == 0) { throw new Exception("Phone number is required."); } dtoOrder.OrderId = Guid.NewGuid(); dtoOrder.TotalCost = PizzaPriceManager.CalculateCost(dtoOrder); Persistance.OrderRepository.CreateOrder(dtoOrder); }
public static void CreateOrder(DTO.OrderDTO orderDTO) { // validation if (orderDTO.Name.Trim().Length == 0) { throw new Exception("Name is required."); } if (orderDTO.Address.Trim().Length == 0) { throw new Exception("Address is required."); } if (orderDTO.ZIP.Trim().Length == 0) { throw new Exception("ZIP is required"); } if (orderDTO.Phone.Trim().Length == 0) { throw new Exception("Phone is required"); } orderDTO.OrderId = Guid.NewGuid(); orderDTO.TotalCost = PizzaPriceManager.CalculatePizzaPrice(orderDTO); Persistence.OrderRepository.CreateOrder(orderDTO); }