public ActionResult NewCustomer(int?id)
        {
            NewCustomerViewModel model = new NewCustomerViewModel();

            model.GenderList = EnumHelpers.ConvertEnumToList(typeof(Genders));

            List <string> CountryList = new List <string>();

            CultureInfo[] CInfoList = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
            foreach (CultureInfo CInfo in CInfoList)
            {
                RegionInfo R = new RegionInfo(CInfo.LCID);
                if (!(CountryList.Contains(R.EnglishName)))
                {
                    CountryList.Add(R.EnglishName);
                }
            }

            CountryList.Sort();
            ViewBag.CountryList = CountryList;

            if (id == null)
            {
                model.Customer = new Customers();
            }
            else
            {
                model.Customer = _customersManagement.Get(d => d.ID == id);
                model.BookList = _booksManagement.GetAll(b => b.CustomerID == id && !b.IsCancelled).OrderBy(b => b.ArrivalDate).ToList();
            }

            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult NewEmployee(int?id)
        {
            NewEmployeeViewModel model = new NewEmployeeViewModel();

            model.GenderList = EnumHelpers.ConvertEnumToList(typeof(Genders));

            List <string> CountryList = new List <string>();

            CultureInfo[] CInfoList = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
            foreach (CultureInfo CInfo in CInfoList)
            {
                RegionInfo R = new RegionInfo(CInfo.LCID);
                if (!(CountryList.Contains(R.EnglishName)))
                {
                    CountryList.Add(R.EnglishName);
                }
            }

            CountryList.Sort();
            ViewBag.CountryList = CountryList;

            if (id == null)
            {
                model.Employee = new Employees();
            }
            else
            {
                model.Employee = _employeesManagement.Get(d => d.ID == id);
            }

            return(View(model));
        }
Exemplo n.º 3
0
        public IActionResult Index()
        {
            var vm = new SearchViewModel
            {
                SearchOptions        = new List <SearchOption>(EnumHelpers.ConvertEnumToList <SearchEnum>().Select(x => new SearchOption(x.ToString()))),
                ResultCountOptions   = SelectListHelper.CreateSelectListFromIntArray(new[] { 100, 50, 20, 10 }, true),
                SelectedSearchOption = new SearchOption(SearchEnum.Google.ToString())
            };

            return(View(vm));
        }
        public ActionResult NewTestimonial(int?id)
        {
            NewTestimonialViewModel model = new NewTestimonialViewModel()
            {
                BookList          = _bookManagement.GetAll().ToList(),
                ShowingStatusList = EnumHelpers.ConvertEnumToList(typeof(ShowStatus))
            };

            if (id == null)
            {
                model.Testimonial = new Testimonials();
            }
            else
            {
                model.Testimonial = _testimonialsManagement.Get(d => d.ID == id);

                model.ShowingStatus = ConvertHelpers.ConvertBoolToInt(model.Testimonial.IsShow);
            }

            return(View(model));
        }