public async Task <IActionResult> UpdateStaff(int id, StaffForRegisterDto staffForRegisterDto)
        {
            staffForRegisterDto.UserName = staffForRegisterDto.UserName.ToLower();

            if (await repo.UserExists(staffForRegisterDto.UserName))
            {
                return(BadRequest("Username Already In Use"));
            }

            var staffForUpdate = await repo.GetStaff(id);

            if (staffForUpdate == null)
            {
                BadRequest("No Staff Member Found");
            }

            mapper.Map(staffForRegisterDto, staffForUpdate);

            if (await repo.SaveAll())
            {
                return(NoContent());
            }

            throw new Exception($"Updating staff {id} failed on save");
        }
        public async Task <IActionResult> CreateStaff(StaffForRegisterDto staffForRegisterDto)
        {
            var userToCreate = mapper.Map <User>(staffForRegisterDto);

            var result = await userManager.CreateAsync(userToCreate, staffForRegisterDto.Password);

            await userManager.AddToRoleAsync(userToCreate, "Staff");

            var userToReturn = mapper.Map <UserForDetailedDto>(userToCreate);

            if (result.Succeeded)
            {
                return(CreatedAtRoute("GetUser", new { controller = "User", id = userToCreate.Id }, userToReturn));
            }

            return(BadRequest(result.Errors));
        }