Ejemplo n.º 1
0
        public bool DeleteOneTown()
        {
            Town town = _repository.GetAllList().Query(_city.Trim(), _district.Trim(), _town.Trim());

            if (town == null)
            {
                return(false);
            }
            _repository.Delete(town);
            return(true);
        }
Ejemplo n.º 2
0
 public bool Delete(Town entity)
 {
     if (entity != null)
     {
         _townRepository.Delete(entity);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
 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));
     }
 }
Ejemplo n.º 4
0
 /// <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)));
        }