public async Task <IActionResult> PutOrders(int id, Orders orders)
        {
            if (id != orders.Oid)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutMedicine(int id, Medicine medicine)
        {
            if (id != medicine.Mid)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 3
0
        public IQueryable <Orders> DeleteOrders(int id)
        {
            IQueryable <Orders> orders = _context.Orders.Where(p => p.Oid == id);

            _context.Orders.Remove(orders.FirstOrDefault());
            _context.SaveChangesAsync();
            return(orders);
        }
Exemplo n.º 4
0
        public IQueryable <Medicine> DeleteMedicine(int id)
        {
            //var medicine = await _context.Medicine.FindAsync(id);

            IQueryable <Medicine> medicine = _context.Medicine.Where(p => p.Mid == id);

            _context.Medicine.Remove(medicine.FirstOrDefault());
            _context.SaveChangesAsync();

            return(medicine);
        }