Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            IndexViewModel viewModel = new IndexViewModel();

            viewModel.Initialize(repository);

            return(View(viewModel));
        }
Exemplo n.º 3
0
        public ActionResult Save(IndexViewModel viewModel)
        {
            viewModel.Initialize(repository);

            if (ModelState.IsValid)
            {
                viewModel.Save();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View("Index", viewModel));
            }
        }
Exemplo n.º 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));
     }
 }
Exemplo n.º 5
0
 public ActionResult Index(IndexViewModel vm)
 {
     vm.Initialize(Db);
     return(View(vm));
 }