public async Task <IActionResult> Draft(long?account, long?project)
        {
            if (account == null && project == null)
            {
                return(new RedirectToActionResult("Index", "Search", null));
            }

            var date = project.HasValue
                ? _projectRepositiory.GetNextRelease(project.Value)
                : _projectRepositiory.GetNextRelease(_userRepositiory.GetDefaultProject(account.Value));
            var orders = _orderRepositiory.GetDraftOrders(account, project, date);

            var validationResults = await _queryingClient.Manual(orders.Keys.ToArray(), date, project);

            var feature = HttpContext.Features.Get <IRequestCultureFeature>();
            var factory = new MessageFactory(_linkSettings, orders, feature.RequestCulture.Culture);

            ViewBag.Message = string.Format(feature.RequestCulture.Culture, "Выведены результаты за {0:Y}", date);


            return(View(new MessageContainerModel
            {
                AccountId = account,
                AccountName = account.HasValue ? _userRepositiory.GetAccountName(account.Value) : null,
                ProjectId = project,
                ProjectName = project.HasValue ? _projectRepositiory.GetProjectName(project.Value) : null,
                Results = validationResults.Select(factory.CreateMessage),
            }));
        }
Esempio n. 2
0
        public IActionResult Index()
        {
            var account = _userRepositiory.GetUserId(User.Identity.Name);
            var project = _userRepositiory.GetDefaultProject(account);

            return(new RedirectToActionResult("Index", "Search", new { account = account, project = project }));
        }