private ActionResult MakeAnOrderComplete(CustomerOrderViewModel model) { try { var cmd = new MakeNewOrderCommand { CustomerId = new Guid(Request.Params["CustomerId"]) }; foreach (var item in model.OrderItems) { cmd.Quantities.Add(item.ProductId, item.Quantity); } using (var s = UnitOfWork) { var ctx = new ContextHandler <Order, MakeNewOrderRole>(repo); ctx.Bind(cmd) .Execute(); s.Commit(); } return(MakeAnOrder()); } catch (Exception err) { throw err; } }
public ActionResult Register(CreateNewProductCommand cmd) { try { using (var s = UnitOfWork) { ContextHandler<Product, CreateNewProductRole> ctx = new ContextHandler<Product, CreateNewProductRole>(repo); ctx.Bind(cmd) .Execute(); s.Commit(); return View(); } } catch (Exception err) { return null; } }
public ActionResult Register(CreateNewCustomerCommand cmd) { using (var s = UnitOfWork) { try { ContextHandler <Customer, CreateNewCustomerRole> ctx = new ContextHandler <Customer, CreateNewCustomerRole>(repo); ctx.Bind(cmd) .Execute(); s.Commit(); return(View()); } catch (Exception err) { throw new Exception(err.Message); } } }
public ActionResult Edit(Guid id, Guid rowId, Guid customerId, Guid productId) { try { using (var s = UnitOfWork) { var cmd = new ChangeProductQuantityInOrderItemCommand { AggregateRootId = id, RowId = rowId, CustomerId = customerId, ProductId = productId, Quantity = 5 }; var ctx = new ContextHandler<Order, ChangeProductQuantityInOrderItemRole>(repo); ctx.Bind(cmd) .Execute(); s.Commit(); } } catch (Exception err) { } return null; }
public ActionResult Register(CreateNewProductCommand cmd) { try { using (var s = UnitOfWork) { ContextHandler <Product, CreateNewProductRole> ctx = new ContextHandler <Product, CreateNewProductRole>(repo); ctx.Bind(cmd) .Execute(); s.Commit(); return(View()); } } catch (Exception err) { return(null); } }
public ActionResult Edit(Guid id, Guid rowId, Guid customerId, Guid productId) { try { using (var s = UnitOfWork) { var cmd = new ChangeProductQuantityInOrderItemCommand { AggregateRootId = id, RowId = rowId, CustomerId = customerId, ProductId = productId, Quantity = 5 }; var ctx = new ContextHandler <Order, ChangeProductQuantityInOrderItemRole>(repo); ctx.Bind(cmd) .Execute(); s.Commit(); } } catch (Exception err) { } return(null); }
public ActionResult Register(CreateNewCustomerCommand cmd) { using (var s = UnitOfWork) { try { ContextHandler<Customer, CreateNewCustomerRole> ctx = new ContextHandler<Customer, CreateNewCustomerRole>(repo); ctx.Bind(cmd) .Execute(); s.Commit(); return View(); } catch(Exception err) { throw new Exception(err.Message); } } }
private ActionResult MakeAnOrderComplete(CustomerOrderViewModel model) { try { var cmd = new MakeNewOrderCommand { CustomerId = new Guid(Request.Params["CustomerId"]) }; foreach (var item in model.OrderItems) { cmd.Quantities.Add(item.ProductId, item.Quantity); } using (var s = UnitOfWork) { var ctx = new ContextHandler<Order, MakeNewOrderRole>(repo); ctx.Bind(cmd) .Execute(); s.Commit(); } return MakeAnOrder(); } catch(Exception err) { throw err; } }