Beispiel #1
0
        public ActionResult AddPie()
        {
            var addPie    = _context.PieCategories.ToList();
            var viewModel = new NewPieViewModel
            {
                PieCategories = addPie
            };

            return(View(viewModel));
        }
Beispiel #2
0
        public ActionResult AddPie()
        {
            HttpResponseMessage response1 = GlobalVariables.webApiClient.GetAsync("CategoryDDApi").Result;

            var viewModel = new NewPieViewModel
            {
                PieCategories = response1.Content.ReadAsAsync <IEnumerable <PieCategory> >().Result
            };

            //var addPie = _context.PieCategories.ToList();
            //var viewModel = new NewPieViewModel
            //{
            //    PieCategories = addPie
            //};
            return(View(viewModel));
        }
Beispiel #3
0
        //[HttpPost]
        //public ActionResult CreateCategory(PieCategory pieCategory)
        //{
        //    _context.PieCategories.Add(pieCategory);
        //    _context.SaveChanges();
        //    return RedirectToAction("IndexCategory", "Admin");
        //}
        public ActionResult EditPie(int id)
        {
            var updatePie = _context.Pies.SingleOrDefault(c => c.Id == id);

            if (updatePie == null)
            {
                return(HttpNotFound());
            }
            var vm = new NewPieViewModel
            {
                Pies          = updatePie,
                PieCategories = _context.PieCategories.ToList()
            };

            return(View("AddPie", vm));
        }
Beispiel #4
0
        public ActionResult EditPie(int id)
        {
            HttpResponseMessage response = GlobalVariables.webApiClient.GetAsync($"PieApi/{id}").Result;
            var updatePie = response.Content.ReadAsAsync <Pies>().Result;
            HttpResponseMessage response1 = GlobalVariables.webApiClient.GetAsync("CategoryDDApi").Result;
            //var updatePie = _context.Pies.SingleOrDefault(c => c.Id == id);
            //if (updatePie == null)
            //{
            //    return HttpNotFound();
            //}
            var vm = new NewPieViewModel
            {
                Pies          = updatePie,
                PieCategories = response1.Content.ReadAsAsync <IEnumerable <PieCategory> >().Result
            };

            return(View("AddPie", vm));
        }