public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindAsync(model.Email, model.Password);
                if (user != null)
                {

                    
                    await SignInAsync(user, model.RememberMe);

                  
                    ApplicationDbContext context = new ApplicationDbContext();
                   
                     var UserManager1 = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(context));
                     var UserID = UserManager.FindByEmail(model.Email).Id;


                     if (UserManager1.IsInRole(UserID, "Admin"))
                     {
                         return RedirectToAction("Index", "Home");
                     }
                     else
                     {
                         var allRoles = UserManager1.GetRoles(UserID);

                         var defineroute = FindRoute.FindDefaultRoute(allRoles);

                         return RedirectToAction(defineroute[0], defineroute[1], new { UserID = UserID });
                     
                     }
                   // return RedirectToLocal(returnUrl);
                }
                else
                {
                    ModelState.AddModelError("", "Invalid username or password.");
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }