コード例 #1
0
        public async Task <IActionResult> PutSavedDocket(int id, SavedDocket savedDocket)
        {
            if (id != savedDocket.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <SavedDocket> > PostSavedDocket(SavedDocket savedDocket)
        {
            var userId = User.Claims.First(f => f.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier").Value;

            var user = await _context.Users.FirstOrDefaultAsync(f => f.userID == userId);

            savedDocket.UsersId = user.Id;
            _context.SavedDocket.Add(savedDocket);
            await _context.SaveChangesAsync();

            return(savedDocket);
        }