public ActionResult Delete(int ID) { TagActionModel model = new TagActionModel(); var tag = services.GetTagByID(ID); model.TagID = tag.TagID; return(PartialView("_Delete", model)); }
public ActionResult AddAndEdit(int?ID) { TagActionModel model = new TagActionModel(); if (ID.HasValue) { var suppler = services.GetTagByID(ID.Value); model.TagID = suppler.TagID; model.TagTitle = suppler.TagTitle; } return(PartialView("_AddAndEdit", model)); }
public JsonResult Delete(TagActionModel model) { JsonResult json = new JsonResult(); var result = false; var tag = services.GetTagByID(model.TagID); result = services.DeleteTag(tag); if (result) { json.Data = new { Success = true }; } else { json.Data = new { Success = false, Message = "Unable to perform any action" }; } return(json); }
public JsonResult AddAndEdit(TagActionModel model) { JsonResult json = new JsonResult(); var result = false; if (model.TagID > 0) { var tag = services.GetTagByID(model.TagID); tag.TagTitle = model.TagTitle; tag.UpdatedAt = DateTime.Now; result = services.UpdateTag(tag); } else { Tag tag = new Tag(); tag.TagTitle = model.TagTitle; tag.UpdatedAt = DateTime.Now; result = services.SaveTag(tag); } if (result) { json.Data = new { Success = true }; } else { json.Data = new { Success = false, Message = "Unable to perform any action" }; } return(json); }