Exemplo n.º 1
0
        public async Task <ItemsDto> ChangeItemQuantity(Guid itemId, int quantity)
        {
            try
            {
                var item = await _context.Items.FindAsync(itemId);

                item.Quantity = quantity;
                _context.Entry(item).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                return(_mapper.Map <ItemsDto>(item));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 public ActionResult Edit(Carts carts)
 {
     if (ModelState.IsValid)
     {
         db.Entry(carts).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(carts));
 }