コード例 #1
0
        public async Task <IActionResult> PutLifeEvent(int id, LifeEvent lifeEvent)
        {
            if (id != lifeEvent.LifeEventId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutDoggoType(int id, DoggoType doggoType)
        {
            if (id != doggoType.DoggoTypeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutDoggoAlbum(int id, DoggoAlbum doggoAlbum)
        {
            if (id != doggoAlbum.DoggoAlbumId)
            {
                return(BadRequest());
            }
            doggoAlbum.DoggoAlbumDateCreated = DateTime.Now;


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

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

            return(NoContent());
        }
コード例 #4
0
        public async Task <IActionResult> PutAdopted(int id, Adopted adopted)
        {
            if (id != adopted.AdoptedId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutVirtualAdoption(int id, VirtualAdoption virtualAdoption)
        {
            if (id != virtualAdoption.VirtualAdoptionId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #6
0
        public async Task <IActionResult> PutIntro(int id, Intro intro)
        {
            if (id != intro.IntroId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }