예제 #1
0
        public async Task <IActionResult> PutEcategories(long id, Ecategories ecategories)
        {
            if (id != ecategories.EcategoriesId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <Ecategories> > PostEcategories(Ecategories ecategories)
        {
            _context.Ecategories.Add(ecategories);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (EcategoriesExists(ecategories.EcategoriesId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetEcategories", new { id = ecategories.EcategoriesId }, ecategories));
        }