private OrderDto setOrderDtoFromModel(OrderModel model) { OrderDto orderdto = new OrderDto(); foreach (var order_details in model.order_details) { OrderDetailDto order_detail_dto = new OrderDetailDto(); order_detail_dto.menu_id = order_details.menu_id; order_detail_dto.quantity = order_details.quantity; order_detail_dto.rate = order_details.rate; orderdto.addOrderDatas(order_detail_dto); } orderdto.customer_name = model.customer_name; orderdto.address = model.address; orderdto.email = model.email; orderdto.order_date = DateTime.Now; orderdto.primary_contact = model.primary_contact; orderdto.secondary_contact = model.secondary_contact; orderdto.total_amount = model.total_amount; return(orderdto); }