public async Task <IActionResult> PutCheckOutDetail(int id, CheckOutDetail checkOutDetail)
        {
            if (id != checkOutDetail.Id)
            {
                return(BadRequest());
            }

            _context.Entry(checkOutDetail).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CheckOutDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PutItems(int id, Object item, int Quantity)
        {
            Items items = new Items();

            items.Id          = (int)JObject.Parse(item.ToString())["Id"];
            items.ClothesName = (string)JObject.Parse(item.ToString())["ClothesName"];
            items.Price       = (double)JObject.Parse(item.ToString())["Price"];
            items.Quantity    = (int)JObject.Parse(item.ToString())["Quantity"] - Quantity;
            items.Type        = (string)JObject.Parse(item.ToString())["Type"];
            items.Image       = (string)JObject.Parse(item.ToString())["Image"];
            items.Description = (string)JObject.Parse(item.ToString())["Description"];
            items.CPU         = (string)JObject.Parse(item.ToString())["CPU"];
            items.RAM         = (string)JObject.Parse(item.ToString())["RAM"];
            items.Screen      = (string)JObject.Parse(item.ToString())["Screen"];
            items.OS          = (string)JObject.Parse(item.ToString())["OS"];
            if (id != items.Id)
            {
                return(BadRequest());
            }

            _context.Entry(items).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ItemsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }