public bool DeleteOneTown() { Town town = _repository.GetAllList().Query(_city.Trim(), _district.Trim(), _town.Trim()); if (town == null) { return(false); } _repository.Delete(town); return(true); }
public bool Delete(Town entity) { if (entity != null) { _townRepository.Delete(entity); return(true); } return(false); }
public ActionResult Delete(TownDTO entity) { try { Town t = townRepository.GetById(entity.TownID); townRepository.Delete(t); townRepository.Save(); return(Json(entity, JsonRequestBehavior.DenyGet)); } catch (Exception e) { return(Json(false, JsonRequestBehavior.DenyGet)); } }
/// <summary> /// Method whose purpose is to delete an existing /// town from the database. /// </summary> /// <param name="town"> /// Existing TownModel object. /// </param> /// <returns> /// Returns true if the query is successfully executed /// otherwise returns false. /// </returns> public bool Delete(TownModel town) { return(_townRepository.Delete(town) > 0 ? true : false); }
public async Task <IActionResult> DeleteConfirmed(int id) { var town = await _townRepository.Delete(id); return(RedirectToAction(nameof(Index))); }