public ActionResult AddMonth(Month_Year NewMonth) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("login", "Home")); } var UserRepo = new UserRepository(Properties.Settings.Default._connectionString); var budgetRepo = new BudgetRepository(Properties.Settings.Default._connectionString); //gets user id NewMonth.UserId = UserRepo.GetUserByEmail(User.Identity.Name).Id; bool MonthExists = budgetRepo.AddMonth(NewMonth); if (MonthExists == true) { return(Json(0)); } return(Json(NewMonth.Id)); }
public BudgetViewModel() { LatestMonth = new Month_Year(); }