Пример #1
0
        public async Task <User> CreateUser(User user)
        {
            user.Password = BCrypt.Net.BCrypt.HashPassword(user.Password);
            _context.Users.Add(user);
            await _context.SaveChangesAsync();

            return(user);
        }
Пример #2
0
        public async Task <Designation> CreateDesignation(Designation designation)
        {
            designation.Code = "DES" + designation.Name;
            _context.Designations.Add(designation);
            await _context.SaveChangesAsync();

            return(designation);
        }
        public async Task <Employee> CreateEmployee(Employee user)
        {
            user.Password = BCrypt.Net.BCrypt.HashPassword(user.Password);
            _context.Employees.Add(user);
            await _context.SaveChangesAsync();

            return(user);
        }
Пример #4
0
        public async Task <Department> CreateDepartment(Department department)
        {
            department.Code = "DEP" + department.Name;
            _context.Departments.Add(department);
            await _context.SaveChangesAsync();

            return(department);
        }