public ActionResult Delete(int code, FormCollection collection) { try { // Company company = companiesRepository.getCompany(code); bool used = false; if (companiesRepository.getCompanyCount(code) > 0) { used = true; ViewBag.used = "Negalima pašalinti kompanijos, kuri yra naudojama kitose lentelėse."; return(View(companiesRepository.getCompany(code))); } if (!used) { companiesRepository.deleteCompany(code); } return(RedirectToAction("Index")); } catch { return(View()); } }
/** * DELETE request that disable a company */ public Response Delete(int id) { return(repository.deleteCompany(id)); }
public ActionResult DeleteConfirmed(int id) { cmpRepo.deleteCompany(id); return(RedirectToAction("Index")); }