public ActionResult Edit(int id, Order order) { try { // TODO: Add update logic here DateTime oldStartDate = orderDb.Get(id).StartDate; orderDb.Edit(order); if (order.StartDate == oldStartDate) { return(RedirectToAction(ActionNameIndex)); } else { return(RedirectToAction(ActionNameIndexWithId + id)); } } catch { try { Order_Edit model = new Order_Edit(customerDb, employeeDb, statusDb, order);; return(View(model)); } catch (NotFoundInDatabaseException) { return(View(ViewNameNotFound)); } } }
public IActionResult Finish(OrderListViewModel model) { var order = _orderData.Get(model.orderId); if (ModelState.IsValid) { order.isDone = true; _orderData.Save(order); } return(RedirectToAction("Index")); }
public Order_Detail(IEmployeeData employeeData, ICustomerData customerData, IStatusData statusData, IOrderData orderData, int orderId) : base() { Order order = orderData.Get(orderId); if (order == null) { throw new NotFoundInDatabaseException(); } Employee employee = employeeData.Get(order.EmployeeId); IEnumerable <Status> statuses = statusData.GetAll(); Construtor(employee, customerData, statuses, order); }
public Order_FullDetails(ICustomerData customerData, IEmployeeData employeeData, IImageData imageData, IOrderData orderData, IPartData partData, IOrderPartData OrderPartData, IStatusData statusData, int orderId) { Order order = orderData.Get(orderId); if (order == null) { throw new NotFoundInDatabaseException(); } Employee employee = employeeData.Get(order.EmployeeId); Details = new Order_Detail(employee, customerData, statusData, order); this.OrderParts = new List <OrderPart_Detail>(); EmployeePayPerHour = employee.PayPerHour; IEnumerable <OrderPart> OrderParts = OrderPartData.Get(orderId); foreach (OrderPart OrderPart in OrderParts) { OrderPart_Detail newDetail = new OrderPart_Detail(partData, OrderPart); this.OrderParts = this.OrderParts.Concat(new[] { newDetail }); } Images = imageData.GetOrderImages(orderId); }
public Order_Edit(ICustomerData customerDb, IEmployeeData employeeDb, IStatusData statusDb, IOrderData orderDb, int id) : this(customerDb, employeeDb, statusDb, orderDb.Get(id)) { if (Order == null) { throw new NotFoundInDatabaseException(); } }