public JsonResult DeleteLocation(long locationId) { if (_locationSvc.DeleteLocation(locationId) == true) { return(Json("Success", JsonRequestBehavior.AllowGet)); } return(Json("Failure", JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> DeleteLocation(int id) { if (id == 0) { return(BadRequest("Please Enter A Valid ID")); } if (await _location.LocationExist(id)) { await _location.DeleteLocation(id); return(NoContent()); } return(NotFound("No Location Was Found")); }
protected void lnkDelete_Click(object sender, EventArgs e) { var DeletButton = (Control)sender; GridViewRow row = (GridViewRow)DeletButton.NamingContainer; int Loc_ID = Convert.ToInt32(row.Cells[0].Text); int DeleteResult = location.DeleteLocation(Loc_ID); if (DeleteResult > 0) { dataTable.Rows.Clear(); LoadGridTable(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Success", "alert('Location : " + Loc_ID + " was deleted');", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed", "alert('Something went wrong');", true); } }
/// <summary> /// 删除一行数据 /// </summary> /// <param name="LocationId"></param> /// <returns></returns> bool DeleteLocation(string LocationId) { return(SetLocation.DeleteLocation(LocationId)); }