public ActionResult Commit(int distr_id, int store_id, int matmodel_id, int devmodel_id) { Shippingitemdistribute theDistr = new Shippingitemdistribute(); theDistr = theDistr.GetById(distr_id); if (matmodel_id > 0) { for (int i = 0; i < theDistr.Count; i++) { Material model = new Material(); model.Matmodel = (new Matmodel()).GetById(matmodel_id); model.Store = (new Store()).GetById(store_id); model.StatusID = 1; model.Save(model); } theDistr.Status = 3; theDistr.Update(theDistr); } if (devmodel_id > 0) { for (int i = 0; i < theDistr.Count; i++) { Device model = new Device(); model.Devmodel = (new Devmodel()).GetById(devmodel_id); model.Store = (new Store()).GetById(store_id); model.StatusID = 1; model.Save(model); } theDistr.Status = 3; theDistr.Update(theDistr); } return(View(theDistr)); }
public ActionResult Create(int shippingitem_id, int store_id, int count) { Shippingitemdistribute theModel = new Shippingitemdistribute(); theModel.ShippingitemID = shippingitem_id; theModel.StoreID = store_id; theModel.Status = 1; theModel.Count = count; if ((new Shippingitemdistribute()).GetAll("SHIPPINGITEM_ID=" + shippingitem_id.ToString() + " AND STORE_ID=" + store_id.ToString()).Count > 0) { Shippingitemdistribute theUpdate = (new Shippingitemdistribute()).GetAll("SHIPPINGITEM_ID=" + shippingitem_id.ToString() + " AND STORE_ID=" + store_id.ToString())[0]; theUpdate.ShippingitemID = shippingitem_id; theUpdate.StoreID = store_id; theUpdate.Count = count; theUpdate.Status = 1; theUpdate.Update(theUpdate); return(View(theUpdate)); } else { theModel.ShippingitemID = shippingitem_id; theModel.StoreID = store_id; theModel.Count = count; theModel.Save(theModel); return(View(theModel)); } }