public ActionResult Edit(ItemProperty itemProperty) { if (ModelState.IsValid) { if (this.genericMgr.FindAll<long>("select count(*) from ItemProperty as f where f.RmItem=? and f.Viscosity=? and f.SfgItem=? and f.Flow=? and Id!=? ", new object[] { itemProperty.RmItem, itemProperty.Viscosity, itemProperty.SfgItem, itemProperty.Flow, itemProperty.Id })[0] > 0) { base.SaveErrorMessage(string.Format(Resources.EXT.ControllerLan.Con_SameGlueMaterialCodeAlreadyExists, itemProperty.RmItem, itemProperty.Viscosity, itemProperty.SfgItem, itemProperty.Flow)); return View(itemProperty); } this.genericMgr.UpdateWithTrim(itemProperty); SaveSuccessMessage(Resources.CUST.ItemProperty.ItemProperty_Updated); } return View(itemProperty); }
public ActionResult New(ItemProperty itemProperty) { try { //ModelState.Remove("Qty"); if (ModelState.IsValid) { if (this.genericMgr.FindAll<long>("select count(*) from ItemProperty as f where f.RmItem=? and f.Viscosity=? and f.SfgItem=? and f.Flow=? ", new object[] { itemProperty.RmItem, itemProperty.Viscosity, itemProperty.SfgItem, itemProperty.Flow })[0] > 0) { base.SaveErrorMessage(string.Format(Resources.EXT.ControllerLan.Con_SameGlueMaterialCodeAlreadyExists, itemProperty.RmItem, itemProperty.Viscosity, itemProperty.SfgItem, itemProperty.Flow)); return View(itemProperty); } this.genericMgr.CreateWithTrim(itemProperty); SaveSuccessMessage(Resources.CUST.ItemProperty.ItemProperty_Added); int id = itemProperty.Id; //return RedirectToAction("Edit", new object[] { ProductLine, Item }); return new RedirectToRouteResult(new RouteValueDictionary { { "action", "Edit" }, { "controller", "ItemProperty" }, { "id", id } }); } } catch (Exception e) { if (e is CommitResourceException) { SaveErrorMessage(Resources.EXT.ControllerLan.Con_SameGlueMaterialAttributeAlreadyExists); } } return View(itemProperty); }