ASP.NET MVC异步控制器无法工作

时间:2016-03-10 09:47:56

标签: c# asp.net asynchronous

您好我有问题 当我尝试调用函数 GetDataById 时,方法控制器不起作用 我尝试调试但在调用方法 GetDataById 之后我无法继续

    [HttpPost]
    public async Task<ActionResult> CreateEmployee(RegisterModel model)
    {


        var d = new DistrictService();
        var r = new RegionService();
        var region = r.GetDataById(model.RegionId);
        var district = d.GetDataById(model.DistrictId);


        var user = new User
        {
            UserName = model.Email,
            FullName = model.FullName,
            Email = model.Email,
            District = district,
            Region = null,
            Address = model.Address
        };

        var result = await userManager.CreateAsync(user, model.Password);

        if (result.Succeeded)
        {
            var resOfAddRoleToUser = userManager.AddToRole(user.Id, model.Role);
            await SignIn(user);
        }

        foreach (var error in result.Errors)
        {
            ModelState.AddModelError("", error);
        }            
    }

但程序输入GetDataById方法

0 个答案:

没有答案