示例#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)));
        }
        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);
            }
        }