/// <summary>
 /// Dodaje pracownika do bazy danych
 /// </summary>
 /// <param name="newEmployee">Nowy pracownik</param>
 public IHttpActionResult Post(EmployeeAddDto newEmployee)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest();
     }
     Employee employee = Mapper.Map<Employee>(newEmployee);
     var password = RandomString(15);
     var role = newEmployee.Role;
     var user = new User { UserName = GenerateUserName(employee) };
     if (context.Users.Any(u => user.UserName == u.UserName))
     {
         return BadRequest();
     }
     var result = userManager.Create(user, password);
     if (!result.Succeeded)
     {
         return BadRequest(result.Errors.ToString());
     }
     userManager.AddToRole(user.Id, role.ToString());
     employee.User = user;
     context.Employees.Add(employee);
     context.SaveChanges();
     using (var eh = new EMailHelper())
     {
         eh.SendEmail(employee.Email, "Instant Delivery - Rejestracja", eh.RegistrationBody(employee, password));
     }
     return Ok(employee.Id);
 }
 protected override void OnDeactivate(bool close)
 {
     if (close)
         NewEmployee = null;
 }
 /// <summary>
 /// Dodaje pracownika do bazy danych.
 /// </summary>
 /// <param name="employee"></param>
 /// <returns></returns>
 public async Task AddEmployee(EmployeeAddDto employee)
 {
     await PostAsJson("", employee);
 }