public async Task <IViewComponentResult> InvokeAsync()
        {
            var tournaments = await _service.GetInProgressTournaments();

            var viewModel = new InProgressViewModel
            {
                InProgress = tournaments
            };

            return(View(viewModel));
        }
Esempio n. 2
0
        public async Task <bool> AssignInProgress(string projectId, InProgressViewModel model)
        {
            StringContent modelJson = new StringContent(JsonSerializer.Serialize(model), Encoding.UTF8, "application/json");
            var           response  = await httpClient.PutAsync($"api/MongoProject/api/v1/project/Inprogress/{projectId}", modelJson);

            if (response.IsSuccessStatusCode)
            {
                var result = await JsonSerializer.DeserializeAsync <InProgressViewModel>(await response.Content.ReadAsStreamAsync());

                return(true);
            }
            return(false);
        }
        public async Task <IActionResult> Inprogress([FromRoute] string projectId, [FromForm] InProgressViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _mongoProjectService.AssignInProgress(projectId, model);

                if (result)
                {
                    return(Ok(new { status = 1, message = "Success to add inprogress" }));
                }
                return(BadRequest(new { status = 1, message = "Something wrong happen" }));
            }
            return(BadRequest(new { status = 0, message = "Bad request" }));
        }
        public async Task <bool> AssignInProgress(string projectId, InProgressViewModel model)
        {
            var project = await _NoDb.FindAsync(projectId, projectId);

            var inprogress = new InProgress
            {
                Id          = Guid.NewGuid().ToString(),
                Descreption = model.Descreption,
                Name        = model.Name,
                StartDate   = model.StartDate,
                EndDate     = model.EndDate
            };

            project.Framework.Id = Guid.NewGuid().ToString();
            project.Framework.InProgress.Add(inprogress);
            var result = await _NoDb.UpdateAsync(project);

            return(result.IsSuccess);
        }
        public async Task <bool> AssignInProgress(string projectId, InProgressViewModel model)
        {
            var result = await _Projects.FindAsync(proj => proj.Id == projectId);

            var project = await result.SingleOrDefaultAsync();

            var inprogress = new MongoInProgress
            {
                Id          = Guid.NewGuid().ToString(),
                Descreption = model.Descreption,
                Name        = model.Name,
                StartDate   = model.StartDate,
                EndDate     = model.EndDate
            };

            project.Framework.InProgress.Add(inprogress);
            var resultReplace = await _Projects.ReplaceOneAsync(proj => proj.Id == projectId, project);

            return(resultReplace.IsAcknowledged);
        }
Esempio n. 6
0
        public IActionResult InProgress()
        {
            List <ToDo> InProgressTodos = _todoService.GetAllToDos()
                                          .Where(t => t.Status == Status.InProgress)
                                          .ToList();
            List <ToDoViewModel> inProgressView = new List <ToDoViewModel>();

            foreach (var toDo in InProgressTodos)
            {
                List <SubTaskViewModel> subTaskView = new List <SubTaskViewModel>();
                foreach (var subtask in toDo.SubTasks)
                {
                    subTaskView.Add(new SubTaskViewModel()
                    {
                        Title      = subtask.Title,
                        Descrition = subtask.Descrition,
                        SubStatus  = subtask.SubStatus
                    });
                }
                inProgressView.Add(new ToDoViewModel()
                {
                    Id              = toDo.Id,
                    Title           = toDo.Title,
                    Descrition      = toDo.Descrition,
                    ImporanceOfTask = toDo.ImporanceOfTask,
                    TypeOfTodo      = toDo.TypeOfToDo,
                    Status          = toDo.Status,
                    SubTasks        = subTaskView
                });
            }
            InProgressViewModel model = new InProgressViewModel()
            {
                InProgressTasks = inProgressView
            };

            return(View(model));
        }
Esempio n. 7
0
 protected override void OnInitialized()
 {
     InProgress = new InProgressViewModel {
         StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(1)
     };
 }