Пример #1
0
        /// <summary>
        /// Возвращает представление со списком отзывов пользователей
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> ViewFeedbacks(string author, string category, int?page, FeedbackOrderBy orderBy = FeedbackOrderBy.Date)
        {
            var model = new IndexViewModel(_repository, _creator);
            await model.Initialize(author, category, orderBy, page ?? 1);

            return(View(model));
        }
Пример #2
0
        public ActionResult Index()
        {
            IndexViewModel viewModel = new IndexViewModel();

            viewModel.Initialize(repository);

            return(View(viewModel));
        }
Пример #3
0
        public ActionResult Save(IndexViewModel viewModel)
        {
            viewModel.Initialize(repository);

            if (ModelState.IsValid)
            {
                viewModel.Save();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View("Index", viewModel));
            }
        }
Пример #4
0
 public ActionResult Categorise(IndexViewModel vm)
 {
     vm.Initialize(Db);
     if (TryValidateModel(vm.Categorisation))
     {
         foreach (var trx in vm.AllTransactions)
         {
             trx.Category = vm.Categorisation.Category;
         }
         Db.SaveChanges();
         if (vm.Categorisation.CreateRule)
         {
             var rule = Db.CategorisationRules.Add(new CategorisationRule(vm.Search.Search, vm.Categorisation.Category));
             Db.SaveChanges();
         }
         return(RedirectToAction("Index", new IndexViewModel(vm.Search).ToRouteValues()));
     }
     else
     {
         vm.Categorisation.Show();
         return(View("Index", vm));
     }
 }
Пример #5
0
 public ActionResult Index(IndexViewModel vm)
 {
     vm.Initialize(Db);
     return(View(vm));
 }