public ActionResult Create(Tag tag) { if (ModelState.IsValid) { tagRepository.InsertOrUpdate(tag); tagRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }
public void InsertOrUpdate(Tag tag) { if (tag.TagId == default(int)) { // New entity context.Tags.Add(tag); } else { // Existing entity context.Tags.Attach(tag); context.Entry(tag).State = EntityState.Modified; } }
public void InsertOrUpdate(Tag tag) { throw new NotImplementedException(); }