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

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PutUserrole(int id, Userrole userrole)
        {
            if (id != userrole.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #3
0
 public async Task <int> SaveAsync()
 {
     try
     {
         return(await _context.SaveChangesAsync());
     }
     catch (Exception e)
     {
         throw e;
     }
 }