public void EditPart(Parts part) { #region Vertification var errors = new NameValueCollection(); if (errors.Count > 0) throw new RuleException(errors); #endregion context.Entry(Parts).State = EntityState.Modified; context.SaveChanges(); }
public void SavePart(Parts part) { #region Vertification var errors = new NameValueCollection(); if (errors.Count > 0) throw new RuleException(errors); #endregion if (part.PartID == null) { part.PartID = GenerateRandomCode.create_11(); } context.Parts.Add(part); context.SaveChanges(); }
public ActionResult edit(Parts part) { if(ModelState.IsValid) { try { repository.SavePart(part); } catch(RuleException ex) { ex.CopyToModelState(ModelState); } } return View(); }