コード例 #1
0
        public ActionResult Create()
        {
            ViewBag.Countries = SelectListHelper.GetCountries(countryService);
            ViewBag.TeaSorts  = SelectListHelper.GetEnum <TeaSortBll>();
            ViewBag.Qualities = SelectListHelper.GetEnum <QualityBll>();

            return(View());
        }
コード例 #2
0
        public ActionResult Index()
        {
            List <TeaView> allTea = teaService.GetAll().Select(TeaMapper.Map).ToList();

            ViewBag.Countries = SelectListHelper.GetCountries(countryService);
            ViewBag.TeaSorts  = SelectListHelper.GetEnum <TeaSortBll>();

            return(View(allTea));
        }
コード例 #3
0
        public ActionResult Index()
        {
            List <CoffeeView> allCoffee = coffeeService.GetAll().Select(CoffeeMapper.Map).ToList();

            ViewBag.Countries   = SelectListHelper.GetCountries(countryService);
            ViewBag.CoffeeSorts = SelectListHelper.GetEnum <CoffeeSortBll>();

            return(View(allCoffee));
        }
コード例 #4
0
        public ActionResult Edit(Guid id)
        {
            TeaView Tea = teaService.GetById(id).Map();

            ViewBag.Countries = SelectListHelper.GetCountries(countryService);
            ViewBag.TeaSorts  = SelectListHelper.GetEnum <TeaSortBll>();
            ViewBag.Qualities = SelectListHelper.GetEnum <QualityBll>();

            return(View(Tea));
        }
コード例 #5
0
        public ActionResult Edit(Guid id)
        {
            CoffeeView coffee = coffeeService.GetById(id).Map();

            ViewBag.Countries   = SelectListHelper.GetCountries(countryService);
            ViewBag.CoffeeSorts = SelectListHelper.GetEnum <CoffeeSortBll>();
            ViewBag.Qualities   = SelectListHelper.GetEnum <QualityBll>();

            return(View(coffee));
        }
コード例 #6
0
        public ActionResult Edited(TeaView Tea)
        {
            if (ModelState.IsValid)
            {
                teaService.Update(Tea.Map());

                return(RedirectToAction("Details", "Tea", new { id = Tea.Id }));
            }

            ViewBag.Countries = SelectListHelper.GetCountries(countryService);
            ViewBag.TeaSorts  = SelectListHelper.GetEnum <TeaSortBll>();
            ViewBag.Qualities = SelectListHelper.GetEnum <QualityBll>();

            return(View("Edit", Tea));
        }
コード例 #7
0
        public ActionResult Edited(CoffeeView coffee)
        {
            if (ModelState.IsValid)
            {
                coffeeService.Update(coffee.Map());

                return(RedirectToAction("Details", "Coffee", new { id = coffee.Id }));
            }

            ViewBag.Countries   = SelectListHelper.GetCountries(countryService);
            ViewBag.CoffeeSorts = SelectListHelper.GetEnum <CoffeeSortBll>();
            ViewBag.Qualities   = SelectListHelper.GetEnum <QualityBll>();

            return(View("Edit", coffee));
        }
コード例 #8
0
        public ActionResult Created(TeaView Tea)
        {
            Tea.Id = Guid.NewGuid();

            if (ModelState.IsValid)
            {
                teaService.Create(Tea.Map());

                return(RedirectToAction("Index", "Tea"));
            }

            ViewBag.Countries = SelectListHelper.GetCountries(countryService);
            ViewBag.TeaSorts  = SelectListHelper.GetEnum <TeaSortBll>();
            ViewBag.Qualities = SelectListHelper.GetEnum <QualityBll>();

            return(View("Create"));
        }
コード例 #9
0
        public ActionResult Created(CoffeeView coffee)
        {
            coffee.Id = Guid.NewGuid();

            if (ModelState.IsValid)
            {
                coffeeService.Create(coffee.Map());

                return(RedirectToAction("Index", "Coffee"));
            }

            ViewBag.Countries   = SelectListHelper.GetCountries(countryService);
            ViewBag.CoffeeSorts = SelectListHelper.GetEnum <CoffeeSortBll>();
            ViewBag.Qualities   = SelectListHelper.GetEnum <QualityBll>();

            return(View("Create"));
        }
コード例 #10
0
 /// <summary>
 /// Adds available countries to current response
 /// </summary>
 /// <param name="customResponse">The response object</param>
 /// <returns></returns>
 public static CustomResponse WithAvailableCountries(this CustomResponse customResponse)
 {
     return(customResponse.With("availableCountries", SelectListHelper.GetCountries()));
 }