public JsonResult TagForm(Tag tg) { JsonResult rez = new JsonResult(); rez.Data = RenderPartialViewToString("Tag", tg); return rez; }
public JsonResult Tag(Tag tg) { JsonResult rez = new JsonResult(); if (tg.Id == 0) { con.Tags.Add(tg); rez.Data = RenderPartialViewToString("TagRow", tg); } else { con.Entry(tg).State = System.Data.EntityState.Modified; rez.Data = "Внесены изменения в тег."; } con.SaveChanges(); return rez; }