public IHttpActionResult Delete(int id) { try { service.Delete(id); return(Ok()); } catch (EntityNotFoundException e) { return(BadRequest(e.Message)); } }
public IActionResult DeleteComfirmed([Bind] string id) { var success = VacancyService.Delete(id); var model = new IndexPageStatusModel { StatusId = $"{nameof(Edit)}:{success}", VacancyId = id }; return(RedirectToAction(nameof(Index), model)); }
public bool Delete(string id) { var organizationId = Get(id)?.OrganizationId; bool success = VacancyService.Delete(id); if (success && organizationId != null) { var organization = OrganizationService.GetWithVacancies(organizationId); if (organization.Vacancies.Count == 0) { OrganizationService.Delete(organizationId); } } return(success); }