예제 #1
0
        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));
 }
예제 #3
0
 public ActionResult DeleteConfirmed(int id)
 {
     cmpRepo.deleteCompany(id);
     return(RedirectToAction("Index"));
 }