当前位置: 首页>>代码示例>>C#>>正文


C# ApplicationUserManager.FindByEmailAsync方法代码示例

本文整理汇总了C#中ApplicationUserManager.FindByEmailAsync方法的典型用法代码示例。如果您正苦于以下问题:C# ApplicationUserManager.FindByEmailAsync方法的具体用法?C# ApplicationUserManager.FindByEmailAsync怎么用?C# ApplicationUserManager.FindByEmailAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ApplicationUserManager的用法示例。


在下文中一共展示了ApplicationUserManager.FindByEmailAsync方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetStudentsGrade

        public async Task<IHttpActionResult> GetStudentsGrade(string userName, int classId)
        {
            if(userName == null)
            {
                return BadRequest("student parameter must not be empty");
            }

            var @class = await _db.Classes.FindAsync(classId);
            ApplicationUserManager manager = new ApplicationUserManager(new UserStore<ApplicationUser>(_db));
            var student = await manager.FindByEmailAsync(userName);

            if(@class == null || student == null)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Could not match parameters to records"));
            }

            var result = new StudentViewModel(student);
            result.Grade = await _gradeManager.GetStudentGradeAsync(student, @class);

            return Ok(result);
        }
开发者ID:frankibem,项目名称:RGSWeb,代码行数:21,代码来源:GradesController.cs

示例2: _AddToCart

 public async Task<ActionResult> _AddToCart(int ProductID, int wishID, string returnUrl)
 {
     string userName = User.Identity.GetUserName();
     ApplicationDbContext dataSocket = new ApplicationDbContext();
     UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
     userMgr = new ApplicationUserManager(myStore);
     var user = await userMgr.FindByEmailAsync(userName);
     //int customer = (int)user.Customers.CustomerID;
     CartActions myActions = new CartActions();
     WishlistActions wishes = new WishlistActions();
     Cart cart = new Cart();
     cart.CartID = user.Carts.CartID;
     if (myActions.AddToCartAsync(cart.CartID, ProductID))
     {
         myHandler = new BusinessLogicHandler();
         myHandler.DeleteWishlistItem(wishID);
         Session["cartTotal"] = await GetCartTotal(cart.CartID);
         Session["wishlistTotal"] = wishes.GetWishlistTotal(user.Wishlists.WishlistID);
     }
     else
     { }
     //return Json(new { success = true }, JsonRequestBehavior.AllowGet);
     return Redirect(returnUrl); //RedirectToAction(returnUrl);
 }
开发者ID:Gcobani,项目名称:urbanbooks,代码行数:24,代码来源:CartController.cs

示例3: UpdateQuantity

        public async Task<ActionResult> UpdateQuantity(string quantity, string itemId)
        {

            string userName = User.Identity.GetUserName();
            ApplicationDbContext dataSocket = new ApplicationDbContext();
            UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
            userMgr = new ApplicationUserManager(myStore);
            var user = await userMgr.FindByEmailAsync(userName);


            myHandler = new BusinessLogicHandler();
            CartItem item = new CartItem();
            item.CartItemID = Convert.ToInt32(itemId);
            item.CartID = user.Carts.CartID;
            item.Quantity = Convert.ToInt32(quantity);
            if (myHandler.UpdateCartItem(item))
            { return Redirect("/Cart/Edit"); }
            else
            { return Json("Error updating quantity"); }//
        }
开发者ID:Gcobani,项目名称:urbanbooks,代码行数:20,代码来源:CartController.cs

示例4: AddToCart

 public async Task<ActionResult> AddToCart(int ProductID, string returnUrl)
 {
     string userName = User.Identity.GetUserName();
     ApplicationDbContext dataSocket = new ApplicationDbContext();
     UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
     userMgr = new ApplicationUserManager(myStore);
     var user = await userMgr.FindByEmailAsync(userName);
     CartActions myActions = new CartActions();
     Cart cart = new Cart();
     cart.CartID = user.Carts.CartID;
     myHandler = new BusinessLogicHandler();
     IEnumerable<WishlistItem> inWishes = myHandler.GetWishlistItems(user.Wishlists.WishlistID);
     if (inWishes != null)
     {
         WishlistItem item = new WishlistItem();
         try
         {
             item = inWishes.SingleOrDefault(items => items.ProductID == ProductID);
             myHandler.DeleteWishlistItem(item.WishlistItemID);
             TempData["cartAdd"] = "1 item added to cart";
         }
         catch { }
     }
     if (myActions.AddToCartAsync(user.Carts.CartID, ProductID))
     {
         try
         {
             double nm = await GetCartTotal(user.Carts.CartID); string[] xn = nm.ToString().Split('.'); Session["cartTotal"] = xn[0] + "," + xn[1];
             
         }
         catch
         { Session["cartTotal"] = GetCartTotal(user.Carts.CartID); }
     }
     else
     { }
     return Redirect(returnUrl);
 }
开发者ID:Gcobani,项目名称:urbanbooks,代码行数:37,代码来源:CartController.cs


注:本文中的ApplicationUserManager.FindByEmailAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。