public IActionResult Remove(int id) { ApartmentDto apartment = _apartmentRepository.GetDto(id); if (apartment == null) { return(NotFound()); } _apartmentRepository.Delete(id); return(NoContent()); }
public async Task <IActionResult> DeleteConfirmed(int id) { // get apartment Apartment apartment = await apartmentsRepository.GetAsync(id); // delete image DeleteImageIfNotDefault(apartment); // delete apartment apartmentsRepository.Delete(apartment); await unitOfWork.SaveAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> DeleteApartment(int id) { try { await _apartmentRepository.Delete(await _apartmentRepository.FindById(id)); return(Ok()); } catch (ArgumentException e) { return(Conflict(e.Message)); } catch (InvalidOperationException) { return(NotFound()); } catch (DbUpdateException e) { return(Conflict(e.Message)); } }
public Apartment Delete(int id) { return(_apartmentRepository.Delete(id)); }
public void Delete(long id) { _apartmentRepository.Delete(id); }
public void Delete(IEnumerable <Guid> ids) { apartmentRepository.Delete(ids); }
public Apartment Delete(int id) { Apartment model = IApartmentRepository.Get(id); return(IApartmentRepository.Delete(model)); }
public bool Delete(int id) { return(apartmentRepository.Delete(id)); }
public void Delete(int id) { _apartmentRepository.Delete(_apartmentRepository.GetById(id).Result); _apartmentRepository.Save(); }