Пример #1
0
        public async Task <IActionResult> PutEmployees(decimal id, Employees employees)
        {
            if (id != employees.EmployeeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PutVisitTasks(decimal id, VisitTasks visitTasks)
        {
            if (id != visitTasks.TaskId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #3
0
        public async Task <IActionResult> PutUsersEmp(decimal id, UsersEmp usersEmp)
        {
            byte[] salt = new byte[128 / 8];
            using (var rng = RandomNumberGenerator.Create())
            {
                rng.GetBytes(salt);
            }

            usersEmp.PasswordSalt = Convert.ToBase64String(salt);
            usersEmp.Password     = HashingHelper.HashUsingPbkdf2(usersEmp.Password, usersEmp.PasswordSalt);

            if (id != usersEmp.UserId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }