public ActionResult DeletePerson(int id)
        { //Удаляем работника
            DataAccessModel model = new DataAccessModel();

            model.DeletePerson(id);
            return(RedirectToAction("Index"));
        }
        public ActionResult EditPerson(PersonModel obj)
        { // редактируем работника
            DataAccessModel model = new DataAccessModel();

            model.UpdatePerson(obj);
            return(RedirectToAction("Index"));
        }
        // GET: Main
        public ActionResult Index()
        { //Вывод всех пользователей
            DataAccessModel model = new DataAccessModel();

            ViewBag.Items = model.SelectAllPeople();
            return(View());
        }
        public ActionResult DeleteCompany(int id)
        {  //Удаляем компанию
            DataAccessModel model = new DataAccessModel();

            model.DeleteCompany(id);
            return(RedirectToAction("Companies"));
        }
        public ActionResult Companies()
        { // Вывод всех компаний
            DataAccessModel model = new DataAccessModel();

            ViewBag.Companies = model.SelectAllCompanies();

            return(View());
        }
        public ActionResult AddPerson(PersonModel obj)
        {
            //Добавляем работника
            DataAccessModel model = new DataAccessModel();

            model.AddPerson(obj);
            return(RedirectToAction("Index"));
        }
        public ActionResult AddPerson()
        {
            //Переходи на страницу добавления работника
            DataAccessModel model = new DataAccessModel();

            ViewBag.Positions = new SelectList(model.DropDownPositions(), "Value", "Text");
            ViewBag.Companies = new SelectList(model.DropDowmCompanies(), "Value", "Text");
            return(View());
        }
        public ActionResult EditPerson(int id)
        { // Получаем работника для редактирования
            DataAccessModel model = new DataAccessModel();

            ViewBag.Positions = new SelectList(model.DropDownPositions(), "Value", "Text");
            ViewBag.Companies = new SelectList(model.DropDowmCompanies(), "Value", "Text");

            return(View(model.SelectPerson(id)));
        }
 public ActionResult EditCompany(CompanyModel obj)
 { //редактируем компанию
     if (ModelState.IsValid)
     {
         DataAccessModel model = new DataAccessModel();
         model.UpdateCompany(obj);
         return(RedirectToAction("Companies"));
     }
     else
     {
         return(View());
     }
 }
 public ActionResult AddCompany(CompanyModel obj)
 {
     if (ModelState.IsValid)
     {
         //Добавляем компанию
         DataAccessModel model = new DataAccessModel();
         model.AddCompany(obj);
         return(RedirectToAction("Companies"));
     }
     else
     {
         return(View());
     }
 }
        public ActionResult EditCompany(int id)
        {// Получаем компанию для редактирования
            DataAccessModel model = new DataAccessModel();

            return(View(model.SelectCompany(id)));
        }