private void btnDelete_Click(object sender, EventArgs e) { var model = new GroupModel(); model.GROUP_NAME = txtGROUP_NAME.Text; model.ID = int.Parse(txtID.Text); model.Delete(); }
public IActionResult DeleteGroup(int id) { if (ModelState.IsValid) { var model = new GroupModel(); try { var provider = model.Delete(id); model.Response = new ResponseModel($"Group {provider} successfully deleted.", ResponseType.Success); return(RedirectToAction("Index")); } catch (Exception ex) { model.Response = new ResponseModel("Group delete failued.", ResponseType.Failure); // error logger code } } return(RedirectToAction("index")); }
public ActionResult Delete(string id) { var first = new GroupModel() { ID = "" }; string[] tmp = id.Split(','); foreach (string item in tmp) { if (string.IsNullOrEmpty(first.ID)) { first = GroupModel.FirstOrDefault("where Id= @0", item); } GroupModel.Delete("where ID=@0", item); LogDAL.AppendSQLLog(MTConfig.CurrentUserID, typeof(GroupModel)); } return(JsonSuccess(DeleteSuccess, "/Admin/Group/Index?Item.ProductId=" + first.ProductId)); }
// // GET: /Groups/Delete/5 public ActionResult Delete(int id) { if (!AccessActions.IsAccess("Groups::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { // TODO: Add delete logic here GroupModel theGroup = new GroupModel(); theGroup.FindOne(id); theGroup.Delete(); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View("Index")); } }