public ActionResult Create(RetailProductEditModel model) { if (!ModelState.IsValid) { model.ToCompanyList = CompanySvc.LoadCompanyByType((short)CompanyType.RetailCompany); ModelState.AddModelError(string.Empty, "请输入正确信息!"); return View(model); } IIdentity id = HttpContext.User.Identity; var product = WholeSaleProductSvc.LoadById(model.WholeSaleProductId); model.InsertUserName = id.Name; model.ProductStatus = ProductStatus.Retail; model.InsertDate = DateTime.Now; int productId = RetailProductSvc.Insert(model.ToRetailProduct()); if (productId > 0) { product.ProductStatus = ProductStatus.WholeSold; WholeSaleProductSvc.Update(product); } return RedirectToAction("WholeSold"); }
public ActionResult Cut(RetailProductEditModel model) { if (!ModelState.IsValid) { ModelState.AddModelError(string.Empty, "请输入正确信息"); return View(model); } IIdentity id = HttpContext.User.Identity; var product = RetailProductSvc.LoadById(model.ParentId); model.AgriculturalProductId = product.AgriculturalProductId; model.AgriculturalProductName = product.AgriculturalProductName; model.WholeSaleProductId = product.WholeSaleProductId; model.WholeSaleProductName = product.WholeSaleProductName; model.InsertUserName = id.Name; model.ProductStatus = ProductStatus.CanRetail; model.InsertDate = DateTime.Now; int productId = RetailProductSvc.Insert(model.ToRetailProduct()); if (productId > 0) { product.ProductStatus = ProductStatus.CutRetailProduct; RetailProductSvc.Update(product); } return RedirectToAction("CutProduct"); }