Beispiel #1
0
        public async Task <IActionResult> UpdateGood(int id, Good good)
        {
            if (id != good.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Beispiel #2
0
        public async Task <IActionResult> Delete(string id)
        {
            if (id != null)
            {
                Good good = new Good {
                    id = id
                };
                db.Entry(good).State = EntityState.Deleted;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(NotFound());
        }
Beispiel #3
0
 public async Task AddAsync(User item)
 {
     db.Entry(item).State = EntityState.Added;
     await db.SaveChangesAsync();
 }