public UserDataViewModel GetUserData(string userName)
 {
     ApplicationUser user = ((System.Data.Entity.DbSet<ApplicationUser>)context.Users)
                                   .AsNoTracking()
                                   .Include(x=>x.Specality)
                                   .Include(x=>x.Tutors.Select(s=>s.TrainingCourse.Discipline))
                                   .Include(x=>x.Tutors.Select(s=>s.TrainingCourse.Teacher))
                                   .Include(x=>x.Tutors.Select(s=>s.TypeTutors))
                                   .Where(x => x.UserName == userName)
                                   .FirstOrDefault();
     //В случае долгой загрузки переделать как в http://habrahabr.ru/post/269901/
     if (user == null)
     {
         return null;
     }
     UserDataViewModel userDataModel =
         new UserDataViewModel()
         {
             FirstName = user.FirstName,
             SpecalityId = user.SpecalityId,
             Specality = user.Specality,
             SurName = user.SurName,
             VKlink = user.VKlink,
             //TrainingCourses = user.TrainingCourses,
             Tutors = user.Tutors
         };
     return userDataModel;
 }
        public async Task<ActionResult> Edit(UserDataViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    await repository.EditUserDataAsync(model, User.Identity.Name);
                    return RedirectToAction("Index");
                }
                return View(model);

            }
            catch
            {
                return View(model);
            }
        }
 public async Task EditUserDataAsync(UserDataViewModel userData, string userName)
 {
     ApplicationUser user = ((System.Data.Entity.DbSet<ApplicationUser>)context.Users)
                                   .AsNoTracking()
                                   .Include("Specality")
                                   .Include("Tutors")
                                   //.Include("TrainingCourses")
                                   .Where(x => x.UserName == userName)
                                   .FirstOrDefault();
     if (user != null)
     {
         user.FirstName = userData.FirstName;
         user.SpecalityId = userData.SpecalityId;
         user.SurName = userData.SurName;
         user.VKlink = userData.VKlink;
     }
     context.Entry(user).State = System.Data.Entity.EntityState.Modified;
     await context.SaveChangesAsync();
 }