예제 #1
0
        public ActionResult Update(int urun_id)
        {
            var model = new UrunUpdateViewModel
            {
                Urun        = _urunService.GetById(urun_id),
                Kategoriler = _kategoriService.GetAll()
            };

            return(View(model));
        }
예제 #2
0
        public async Task <IActionResult> UrunDuzenle(int id)
        {
            var urun = await urunService.GetById(id);

            var kategoriler = await kategoriService.All();

            ViewBag.Kategoriler = new SelectList(kategoriler, "Id", "Ad");
            return(View(mapper.Map <UrunGuncelleDTO>(urun)));
        }
예제 #3
0
        public IActionResult GetById(int id)
        {
            var result = _urunService.GetById(id);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
예제 #4
0
        public ActionResult AddToCart(int urun_id)
        {
            var urunToBeAdded = _urunService.GetById(urun_id);
            var cart          = _cartSessionService.GetCart();

            _cartService.AddToCard(cart, urunToBeAdded);
            _cartSessionService.SetCart(cart);

            TempData.Add("message", String.Format("Ürününüz, {0}, başarıyla sepete eklendi!", urunToBeAdded.urun_adi));

            return(RedirectToAction("Index", "Urun"));
        }
예제 #5
0
        public async Task<IActionResult> GetFindById(int id)
        {
            UrunResponse urunResponse = await urunService.GetById(id);
            if (urunResponse.Success)
            {
                return Ok(urunResponse.Urun);

            }
            else
            {
                return BadRequest(urunResponse.Message);
            }
        }