Beispiel #1
0
        public ActionResult Create(BookingsViewModels model)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    AccountBook acct = new AccountBook()
                    {
                        Id         = Guid.NewGuid(),
                        Categoryyy = Convert.ToInt32(model.BookType),
                        Amounttt   = model.BookAmount,
                        Dateee     = model.BookDate,
                        Remarkkk   = model.BookMemo
                    };

                    AccountBookService.AddData(acct);
                    AccountBookService.Save();
                    return(RedirectToAction("Index"));
                }

                return(View(model));
            }
            catch
            {
                return(View());
            }
        }
        public List <BookingsViewModels> AccountBookList()
        {
            List <BookingsViewModels> LastDetail = new List <BookingsViewModels>();

            foreach (var item in db.AccountBook.OrderByDescending(d => d.Dateee).Take(10).ToList())
            {
                BookingsViewModels GetAccountBook = new BookingsViewModels();

                GetAccountBook.ID         = item.Id;
                GetAccountBook.BookType   = item.Categoryyy.ToString();
                GetAccountBook.BookAmount = item.Amounttt;
                GetAccountBook.BookDate   = item.Dateee;
                GetAccountBook.BookMemo   = item.Remarkkk;

                LastDetail.Add(GetAccountBook);
            }

            return(LastDetail);
        }