public GeneralInfoPage() { InitializeComponent(); BindingContext = new GeneralInfoViewModel() { ActivityState = new CasualActivityState(), HealthState = new ThreateningHealthState() }; }
public ActionResult Analysis() { var dbContext = new ApplicationDbContext(); var inf = new GeneralInfoViewModel() { UsersCount = dbContext.Users.Count(), UsersBankBalance = dbContext.StatisticsDbModels.Sum(x => x.BankBalance), JobsActive = dbContext.JobDbModels.Count(x => x.IsActivated), JobsDone = dbContext.JobDbModels.Count(x => x.IsDone), JobsInProgress = dbContext.JobDbModels.Count(x => x.InProgress), ModelRanking = GetModelRanking(dbContext), UsersRankingScore = GetUsersRankingScore(dbContext), AviationTypeRanking = GetAviationTypeRanking(dbContext), DepartureRanking = GetDepartureRanking(dbContext, false), DestinationRanking = GetArrivalRanking(dbContext, false), AirlineRankingScore = GetAirlineRankingScore(dbContext), AirlinesChart = GetAirlinesChart(dbContext) }; return(View("Analysis", inf)); //return PartialView("GeneralInfo", inf); }
public ActionResult SaveGeneralInfo(GeneralInfoViewModel model, HttpPostedFileBase photo) { if (ModelState.IsValid) { try { User user = CurrentUser; user.FirstName = model.FirstName; user.LastName = model.LastName; user.MiddleName = model.MiddleName; user.Mobile = model.Mobile; user.Skype = model.Skype; user.Email = model.Email; user.Website = model.Website; user.CurrentCity = model.CurrentCity; if (photo != null && photo.ContentLength > 0) { user.Avatar = photo.InputStream.ReadToEnd(); } UserRepository.Update(user); if (CurrentUser.Email != user.Email) { LogOff(); } return(RedirectToAction("Edit", "Account", new { success = 1 })); } catch (Exception) { ModelState.AddModelError("", Resources.SomethingWrong); } } return(View("Edit", model)); }
public GeneralInfoPage() { InitializeComponent(); BindingContext = viewModel = Startup.ServiceProvider?.GetService <GeneralInfoViewModel>() ?? new GeneralInfoViewModel(); }