示例#1
0
 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);
 }
示例#2
0
    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 });
      }
     
    
    }
示例#3
0
      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();
      }
示例#4
0
 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);
   //}
 }
示例#5
0
      public ActionResult EditStatusReject(OrderingModel model)
      {
        _orderingCommandService.EditStatusReject(new EditStatusRejectCommand(model.OrderingId));
        return ModelState.JsonValidation(new { Success = true, model.OrderingId });

      }
示例#6
0
 public ActionResult EditOrderingFollowingVN(OrderingModel model)
 {
   _orderingCommandService.EditOrderingFollowingVN(new EditOrderingFollowingVNCommand(model.OrderingId));
   return ModelState.JsonValidation(new { Success = true, model.OrderingId });
  
 }
示例#7
0
      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 });

      }
示例#8
0
      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 });

      }
示例#9
0
      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 });

      }