示例#1
0
        public async Task <IActionResult> PutPicturePath([FromRoute] decimal id, [FromBody] PicturePath picturePath)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != picturePath.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PutDeclarationConformity([FromRoute] decimal id, [FromBody] DeclarationConformity declarationConformity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != declarationConformity.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#3
0
        public async Task <IActionResult> PutBuilding([FromRoute] string id, [FromBody] Building building)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != building.Street)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#4
0
        public async Task <IActionResult> PutUserInfo([FromRoute] string id, [FromBody] UserInfo userInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userInfo.IdAspNetUserNavigation.Id)
            {
                return(BadRequest());
            }

            var user = await _context.UserInfo.Include(u => u.IdAspNetUserNavigation)
                       .SingleOrDefaultAsync(m => m.IdAspNetUserNavigation.Id == id);

            user.Birthdate = userInfo.Birthdate;
            user.FirstName = userInfo.FirstName;
            user.LastName  = userInfo.LastName;

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

            try
            {
                await _context.SaveChangesAsync();

                return(Ok());
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
        }