public ActionResult PostAdd(string id, DeliveryFourthModel model) { JsonResultModel result = new JsonResultModel(); try { Validate validate = new Validate(); validate.CheckStringArgument(WebResource.Field_Id, id, true); validate.CheckObjectArgument <DeliveryFourthModel>("model", model); if (validate.IsFailed) { result.BuilderErrorMessage(validate.ErrorMessages); return(Json(result)); } if (this.Session[id] == null) { result.BuilderErrorMessage(WebResource.Message_DeliverySessionOut); result.Data = "/Delivery/First"; return(Json(result)); } model.PostValidate(ref validate); if (validate.IsFailed) { result.BuilderErrorMessage(validate.ErrorMessages); return(Json(result)); } DeliveryAddDTO dto = (DeliveryAddDTO)this.Session[id]; dto.Date = model.Date; dto.ExpressCompany = model.ExpressCompany; dto.ExpressBill = model.ExpressBill; dto.Remark = model.Remark; dto.Creator = this.Session["Mobile"].ToString(); dto.Costs = new List <CostAddDTO>(); foreach (CostAddModel cost in model.Costs) { dto.Costs.Add(new CostAddDTO { Item = cost.Item, Money = cost.Money }); } this.deliveryService.Add(dto); result.Result = true; result.Data = "/Delivery/Index"; return(Json(result)); } catch (Exception ex) { result.BuilderErrorMessage(ex.Message); return(Json(result)); } }
public ActionResult Fourth(string id) { DeliveryFourthModel model = new DeliveryFourthModel(id); if (string.IsNullOrWhiteSpace(model.Id) || this.Session[model.Id] == null) { return(RedirectToAction("First", "Delivery")); } DeliveryAddDTO dto = (DeliveryAddDTO)this.Session[model.Id]; model.CurrentDate = DataConvert.ConvertDateToString(dto.Date); model.ExpressCompany = dto.ExpressCompany; model.ExpressBill = dto.ExpressBill; model.Remark = dto.Remark; return(View(model)); }