public ActionResult Complite(int id) { OrdersDAO odao = new OrdersDAO(); Orders ord = odao.Single(x => x.Id_ord == id); ord.Status = new StatusDAO().Single(x => x._name == "Выполнен").Id; StorageDAO stoDao = new StorageDAO(); Storage add = stoDao.Single(x => x.FK_mat == ord.FK_Mat1); if (add == null) { add = new Storage() { FK_mat = ord.FK_Mat1, Number = ord.Number }; stoDao.insert(add); } else { add.Number += ord.Number; stoDao.update(add); } odao.update(ord); return(RedirectToAction("Index")); }
public ActionResult Edit(Orders obj) { OrdersDAO odao = new OrdersDAO(); odao.update(obj); return(RedirectToAction("Index")); }