public async Task SpreadPlanItems(WebUser user, PlanItem item)
        {
            var planItems = (await _planItemService.GetListAsync(user.Id))
                            .Where(x => x.Closed == false &&
                                   x.Month.Date >= item.Month.Date &&
                                   x.CategoryId == item.CategoryId)
                            .ToList();

            foreach (var planItem in planItems)
            {
                planItem.SummPlan = item.SummPlan;
                await _planItemService.UpdateAsync(planItem);
            }
            await _planItemService.SaveAsync();
        }
Beispiel #2
0
        public async Task <ActionResult> Prepare(WebUser user)
        {
            var categories = (await _categoryService.GetListAsync()).Any(x => x.UserId == user.Id);

            if (categories)
            {
                var planItems = (await _planItemService.GetListAsync(user.Id)).Any();
                return(RedirectToAction(planItems ? "ViewPlan" : "CreatePlan"));
            }
            else
            {
                TempData["message"] = "Сначала необходимо добавить категории, по которым Вы будете делать планирование";
                return(RedirectToAction("Index", "PayingItem"));
            }
        }