Beispiel #1
0
        public ActionResult CitiesList(string symbols = "")
        {
            CityBs           city  = new CityBs();
            List <CityModel> model = city.GetList().Where(c => c.Name.Contains(symbols)).Select(c => (CityModel)c).ToList();

            return(PartialView("~/Views/Admin/_CitiesList.cshtml", model));
        }
Beispiel #2
0
        public ActionResult EditLibrary(EditLibraryModel model)
        {
            if (ModelState.IsValid)
            {
                LibraryBs bs     = new LibraryBs();
                var       result = bs.Update((LibraryDTO)model);

                if (result.Code == BusinessLayer.OperationStatusEnum.Success)
                {
                    TempData["OperationStatus"] = true;
                    TempData["OpearionMessage"] = "Данные успешно обновлены";
                }
                else
                {
                    TempData["OperationStatus"] = false;
                    TempData["OpearionMessage"] = result.Message;
                }

                return(RedirectToAction("Libraries", "Admin"));
            }

            CityBs citybs = new CityBs();

            model.Cities = citybs.GetList().Select(c => (CityModel)c).ToList();
            return(View(model));
        }
Beispiel #3
0
        public ActionResult EditCity(int id)
        {
            CityBs bs = new CityBs();

            CityModel model = (CityModel)bs.GetById(id);

            return(View(model));
        }
Beispiel #4
0
        public ActionResult AddLibrary()
        {
            EditLibraryModel model = new EditLibraryModel();

            CityBs bs = new CityBs();

            model.Cities = bs.GetList().Select(c => (CityModel)c).ToList();

            return(View(model));
        }
Beispiel #5
0
        public ActionResult EditLibrary(int id)
        {
            LibraryBs        libbs = new LibraryBs();
            EditLibraryModel model = (EditLibraryModel)libbs.GetById(id);

            CityBs bs = new CityBs();

            model.Cities = bs.GetList().Select(c => (CityModel)c).ToList();

            return(View(model));
        }
Beispiel #6
0
        public ActionResult DeleteCity(int id)
        {
            CityBs bs     = new CityBs();
            var    result = bs.Delete(id);

            if (result.Code == BusinessLayer.OperationStatusEnum.Success)
            {
                TempData["OperationStatus"] = true;
                TempData["OpearionMessage"] = "Операция завершена упешно";
            }
            else
            {
                TempData["OperationStatus"] = false;
                TempData["OpearionMessage"] = "Ошибка при выполнении операции";
            }

            return(RedirectToAction("Cities", "Admin"));
        }
Beispiel #7
0
        public ActionResult EditCity(CityModel model)
        {
            if (ModelState.IsValid)
            {
                CityBs bs     = new CityBs();
                var    result = bs.Update((CityDTO)model);

                if (result.Code == BusinessLayer.OperationStatusEnum.Success)
                {
                    TempData["OperationStatus"] = true;
                    TempData["OpearionMessage"] = "Операция завершена упешно";
                }
                else
                {
                    TempData["OperationStatus"] = false;
                    TempData["OpearionMessage"] = "Ошибка при выполнении операции";
                }

                return(RedirectToAction("Cities", "Admin"));
            }

            return(View(model));
        }