public void AddAccountBook(AccountBook entity) { SkillTreeHomeworkEntities1 _dbcontext = new SkillTreeHomeworkEntities1(); _dbcontext.AccountBook.Add(entity); _dbcontext.SaveChanges(); }
public List <MoneyListDisplayModel> DisplayList(DateTime date) { var skillTreeHomeworkEntities = new SkillTreeHomeworkEntities1(); return(skillTreeHomeworkEntities.AccountBooks .Where(a => a.Dateee == date) .Select(a => new MoneyListDisplayModel() { Id = a.Id.ToString(), CategoryDisplay = a.Categoryyy, Money = a.Amounttt, Date = a.Dateee }).ToList()); }
public ActionResult Index([Bind(Include = "Category, Money, Date, Description")] MoneyList moneyList) { if (ModelState.IsValid) { var skillTreeHomeworkEntities = new SkillTreeHomeworkEntities1(); skillTreeHomeworkEntities.AccountBooks.Add(new AccountBook() { Id = Guid.NewGuid(), Categoryyy = int.Parse(moneyList.Category), Amounttt = (int)moneyList.Money, Dateee = moneyList.Date, Remarkkk = moneyList.Description }); skillTreeHomeworkEntities.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult List() { var skillTreeHomeworkEntities = new SkillTreeHomeworkEntities1(); int number = 1; var moneyList = skillTreeHomeworkEntities.AccountBooks.OrderByDescending(a => a.Dateee).Take(10).Select(a => new MoneyListDisplayModel() { Id = a.Id.ToString(), CategoryDisplay = a.Categoryyy, Money = a.Amounttt, Date = a.Dateee }).ToList(); foreach (var mm in moneyList) { mm.Category = _EnumHelper.GetEnumDisplayName((Category)mm.CategoryDisplay); mm.Number = number; ++number; } //888 return(View(moneyList)); }
public List <AccountBook> GetAccountBooks() { SkillTreeHomeworkEntities1 _dbcontext = new SkillTreeHomeworkEntities1(); return(_dbcontext.AccountBook.ToList()); }