public ActionResult Create(int CategoryID, int SourceID, Expense expense)
        {
            try
            {
                using (var db = new ApplicationDbContext())
                {
                    var category = (from c in db.Categories where c.CategoryID == CategoryID select c).FirstOrDefault();
                    var source = (from s in db.Sources where s.SourceID == SourceID select s).FirstOrDefault();

                    var userID = User.Identity.GetUserId();

                    ApplicationUser user = (ApplicationUser)(from u in db.Users.ToList()
                                                             where new Guid(u.Id) == new Guid(userID)
                                                             select u).First();

                    var exp = new Expense { Amount = expense.Amount, Title = expense.Title, Description = expense.Description, Category = category, Source = source, Type = expense.Type, UserID = new Guid(userID), User = user, Created = expense.Created };
                    //var expense = new Expense { Amount = 39.99, Title = "Gas", Description = "Gas" };

                    db.Expenses.Add(exp);
                    db.SaveChanges();
                }

                ViewBag.Message = "Expense has been created.";

                GetDropDownData();
                var expe = new Expense();
                return View(expe);
            }
            catch(Exception ex)
            {
                return View();
            }
        }
        public ActionResult Create()
        {
            GetDropDownData();

            var expense = new Expense();
            return View(expense);
        }
        public string User(Expense e, ApplicationDbContext db)
        {
            var user = (ApplicationUser)(from u in db.Users
                                            where e.UserID == new Guid(u.Id)
                                            select u).First();

               return user.UserName;
        }
        public ActionResult Delete(int id, Expense expense)
        {
            using (var db = new ApplicationDbContext())
                {
                    Expense exp = (Expense)(from e in db.Expenses
                                            where e.ExpenseID == id
                                            select e).ToList().First();

                    db.Expenses.Remove(exp);

                    db.SaveChanges();

                    return RedirectToAction("Index");
                }
        }
        public ActionResult Edit(int id, int CategoryID, int SourceID, Expense expense)
        {
            using (var db = new ApplicationDbContext())
                {
                    var category = (from c in db.Categories where c.CategoryID == CategoryID select c).FirstOrDefault();
                    var source = (from s in db.Sources where s.SourceID == SourceID select s).FirstOrDefault();

                    var userID = User.Identity.GetUserId();

                    ApplicationUser user = (ApplicationUser)(from u in db.Users.ToList()
                                                             where new Guid(u.Id) == new Guid(userID)
                                                             select u).First();

                    //var exp = new Expense { Amount = expense.Amount, Title = expense.Title, Description = expense.Description, Category = category, Source = source, Type = expense.Type, UserID = new Guid(userID), User = user };
                    //var expense = new Expense { Amount = 39.99, Title = "Gas", Description = "Gas" };

                    expense.User = user;
                    expense.Category = category;
                    expense.Source = source;
                    expense.Category_CategoryID = category.CategoryID;
                    expense.Source_SourceID = source.SourceID;
                    expense.UserID = new Guid(userID);

                    db.Expenses.Attach(expense);
                    db.Entry(expense).State = EntityState.Modified;

                    db.SaveChanges();
                }

                return RedirectToAction("Index");
        }