static void Main(string[] args) { var chefTypeController = new ChefTypesController(); var chef = new ChefTypePostModel { Name = "Pastry Chef" }; chefTypeController.CreateChef(chef); Console.WriteLine(chefTypeController.GetById(1).Name); var userController = new UsersController(); var user = new UserPostModel() { FullName = "Freddy Krueger", Phone = "+66666661313" }; userController.CreateUser(user); foreach (var person in userController.GetAll()) { Console.Write(person.FullName + " "); Console.WriteLine(person.Phone); } Console.WriteLine(); var waitersController = new WaitersController(); var waiter = new WaiterPostModel() { FullName = "Andrew Miller", Address = "15 Wilson Street" }; var model = waitersController.CreateWaiter(waiter); Console.WriteLine(model.FullName); var orderController = new CateringOrdersController(); var order = new CateringOrderPostModel() { UserId = 1, ChefTypeId = 1, Date = new DateTime(2021, 06, 13), NumberOfPeople = 36, Outdoors = false, Address = "13 Elm Street", WaiterId = 1 }; var newOrder = orderController.CreateCateringOrder(order); Console.WriteLine(newOrder.Id); foreach (var or in orderController.GetAll()) { Console.Write(or.User.FullName + " "); Console.WriteLine(or.ChefType.Name); } Console.WriteLine(); }
public CateringOrderViewModel UpdateCateringOrder(CateringOrderPostModel model) { var order = _mapper.Map <CateringOrderModel>(model); var updatedOrder = _cateringOrderService.UpdateCateringOrder(order); return(_mapper.Map <CateringOrderViewModel>(updatedOrder)); }
public CateringOrderViewModel CreateCateringOrder(CateringOrderPostModel model) { var order = _mapper.Map <CateringOrderModel>(model); var reservedOrder = _cateringOrderService.CreateCateringOrder(order); return(_mapper.Map <CateringOrderViewModel>(reservedOrder)); }
static void Main(string[] args) { var chefController = new ChefController(); var chef = new ChefPostModel { FullName = "Jonas Svensson", ChefType = "Scandinavian Chef" }; chefController.CreateChef(chef); Console.WriteLine(chefController.GetById(3).FullName); var userController = new UserController(); var user = new UserPostModel() { FullName = "Jane Doe", Phone = "+48059993333" }; userController.CreateUser(user); foreach (var person in userController.GetAll()) { Console.Write(person.FullName); Console.WriteLine(person.Phone); } Console.WriteLine(); var orderController = new CateringOrderController(); var order = new CateringOrderPostModel() { UserId = 1, ChefId = 3, Date = new DateTime(2021, 03, 14), NumberOfPeople = 36, Outdoors = true, Address = "35 Jason Ave" }; var newOrder = orderController.CreateCateringOrder(order); Console.WriteLine(newOrder.Id); Console.WriteLine(orderController.GetById(newOrder.Id).User.FullName); }