public ActionResult Edit(Guid? id) { var ordering = new OrderingModel(); if (id != null) ordering = Mapper.Map<OrderingDTO, OrderingModel>(_orderingReportService.GetById((Guid)id)); return PartialView("_Edit", ordering); }
public ActionResult AddOrder(OrderingModel model) { try { if (model.TotalDiscuss == null) { model.TotalDiscuss = 0; } if (model.Price == null) { model.Price = 0; } if (model.Quantity == null) { model.Quantity = 1; } var createCommand = new AddOrderingCommand((Guid)model.PersonId, model.ExchangeRateId, model.Phone, model.Address, model.Note, (double)model.TotalDiscuss); model.OrderingId = _orderingCommandService.AddOrdering(createCommand); _orderingDetailCommandService.AddOrderingDetail(new AddOrderingDetailCommand(model.ProductCode, model.Name, model.Brand, (decimal)model.Price, (int)model.Quantity, model.Note, model.Link, model.LinkUrl, model.Color, model.Size,model.OrderingId)); return ModelState.JsonValidation(new { Success = true, model }); } catch (Exception ex) { return ModelState.JsonValidation(new { Success = false,Error = ex.Message }); } }
public ActionResult Edit(OrderingModel model) { if (!ModelState.IsValid) { return ModelState.JsonValidation(); } try { Save(model); return ModelState.JsonValidation(new { Success = true, model.OrderingId }); } catch (Exception ex) { ModelState.AddModelError("Edit_ordering", ex.Message); } return ModelState.JsonValidation(); }
private void Save(OrderingModel model) { //if (model.OrderingId == Guid.Empty) //{ // var createCommand = new AddOrderingCommand(model.Name,model.Description,model.ImageURL); // model.OrderingId = _orderingCommandService.AddOrdering(createCommand); //} //else //{ // var updateCommand = new EditOrderingCommand(model.OrderingId, model.Name, model.Description, model.ImageURL); // _orderingCommandService.EditOrdering(updateCommand); //} }
public ActionResult EditStatusReject(OrderingModel model) { _orderingCommandService.EditStatusReject(new EditStatusRejectCommand(model.OrderingId)); return ModelState.JsonValidation(new { Success = true, model.OrderingId }); }
public ActionResult EditOrderingFollowingVN(OrderingModel model) { _orderingCommandService.EditOrderingFollowingVN(new EditOrderingFollowingVNCommand(model.OrderingId)); return ModelState.JsonValidation(new { Success = true, model.OrderingId }); }
public ActionResult EditOrderingFollowingUSD(OrderingModel model) { _orderingCommandService.EditOrderingFollowingUSD(new EditOrderingFollowingUSDCommand(model.OrderingId, (double)model.TransportFee, (decimal)model.WeightFee)); return ModelState.JsonValidation(new { Success = true, model.OrderingId }); }
public ActionResult EditOrderingFollowingOrder(OrderingModel model) { _orderingCommandService.EditOrderingFollowingOrder(new EditOrderingFollowingOrderCommand(model.OrderingId,model.NoteApproved,model.TotalCustomFees,model.TotalDomesticCharges,model.TotalShipInternal,model.TotalShipInternal,model.TotalVat,model.TotalWage)); return ModelState.JsonValidation(new { Success = true, model.OrderingId }); }
public ActionResult EditOrderingFollowingDone(OrderingModel model) { _orderingCommandService.EditOrderingFollowingDone(new EditOrderingFollowingDoneCommand(model.OrderingId, (bool)model.IsPaid, (bool)model.IsDelivered)); return ModelState.JsonValidation(new { Success = true, model.OrderingId }); }