/// <summary>
        /// Business logic for processing TaskType record addition
        /// </summary>
        /// <param name="description"></param>
        /// <returns></returns>
        internal object AddTaskTypeBLL(string description)
        {
            // Create a new APIException object to store possible exceptions as checks are performed.
            APIException exceptionList = new APIException();

            Dictionary <string, bool> exceptionTests = new Dictionary <string, bool>()
            {
                { "description parameter cannot be empty", description == null || description.Trim() == string.Empty },
                { "description must be unique", !string.IsNullOrEmpty(description) && _context.TaskTypes.Any(x => x.Description.ToLower() == description.Trim().ToLower()) }
            };

            foreach (KeyValuePair <string, bool> kvp in exceptionTests)
            {
                if (kvp.Value)
                {
                    exceptionList.AddExMessage(kvp.Key);
                }
            }

            if (!exceptionList.HasExceptions)
            {
                // Capitalise the first letter of the first word of the description
                string dbDescription = $"{description.Trim().Substring(0, 1).ToUpper()}{description.Trim().Substring(1)?.ToLower()}";

                TaskTypeDTO newDbObject = new TaskTypeDTO {
                    Description = dbDescription
                };

                return(newDbObject);
            }
            else
            {
                return(exceptionList);
            }
        } // End of AddTaskTypeBLL
Beispiel #2
0
        private TaskTypeDTO Create(TaskTypeViewModel viewModel)
        {
            try
            {
                log.Debug(TaskTypeViewModel.FormatTaskTypeViewModel(viewModel));

                TaskTypeDTO taskType = new TaskTypeDTO();

                // copy values
                viewModel.UpdateDTO(taskType, null); //RequestContext.Principal.Identity.GetUserId());

                // audit
                taskType.CreateBy = null; //RequestContext.Principal.Identity.GetUserId();
                taskType.CreateOn = DateTime.UtcNow;

                // add
                log.Debug("_taskTypeService.AddTaskType - " + TaskTypeDTO.FormatTaskTypeDTO(taskType));

                int id = _taskTypeService.AddTaskType(taskType);

                taskType.TaskTypeId = id;

                log.Debug("result: 'success', id: " + id);

                return(taskType);
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
        } // End of AddTaskTypeBLL

        /// <summary>
        /// Business logic for processing TaskType description change.
        /// </summary>
        /// <param name="taskType"></param>
        /// <returns></returns>
        internal object ModifyTaskTypeBLL(TaskTypeDTO taskType)
        {
            // Create a new APIException object to store possible exceptions as checks are performed.
            APIException exceptionList = new APIException();

            // Due to the number of checks, this approach is more appropriate
            Dictionary <string, bool> exceptionTests = new Dictionary <string, bool>()
            {
                { "Specified TypeID does not exist", !_context.TaskTypes.Any(x => x.TypeID == taskType.TypeID) },
                { "description parameter cannot be empty", taskType.Description == null || taskType.Description.Trim() == string.Empty },
                { "description must be unique", !string.IsNullOrEmpty(taskType.Description) && _context.TaskTypes.Any(x => x.Description.ToLower() == taskType.Description.Trim().ToLower() && x.TypeID != taskType.TypeID) }
            };

            foreach (KeyValuePair <string, bool> kvp in exceptionTests)
            {
                if (kvp.Value)
                {
                    exceptionList.AddExMessage(kvp.Key);
                }
            }

            if (!exceptionList.HasExceptions)
            {
                // Capitalise the first letter of the first word of the description
                string dbDescription = $"{taskType.Description.Trim().Substring(0, 1).ToUpper()}{taskType.Description.Trim().Substring(1)?.ToLower()}";
                taskType.Description = dbDescription;
                return(taskType);
            }
            else
            {
                return(exceptionList);
            }
        } // End of ModifyTaskTypeBLL
Beispiel #4
0
        public static TaskTypeDTO SampleTaskTypeDTO(int id = 1)
        {
            TaskTypeDTO taskType = new TaskTypeDTO();

            // int
            taskType.TaskTypeId = id;
            // string
            taskType.Name = "NameTestValue";
            // string
            taskType.Description = "DescriptionTestValue";
            // bool
            taskType.Active = false;
            // bool
            taskType.IsDeleted = false;
            // int?
            taskType.CreateBy = 1;
            // System.DateTime?
            taskType.CreateOn = new System.DateTime();
            // int?
            taskType.UpdateBy = 1;
            // System.DateTime?
            taskType.UpdateOn = new System.DateTime();

            return(taskType);
        }
Beispiel #5
0
        public void GetTaskTypesPaged_Success_Test()
        {
            // Arrange
            string searchTerm = "";
            int    pageIndex  = 0;
            int    pageSize   = 10;

            // list
            IList <R_TaskType> list = new List <R_TaskType>();

            for (int i = 1; i <= pageSize; i++)
            {
                list.Add(SampleTaskType(i));
            }

            // create mock for repository
            var mock = new Mock <ITaskTypeRepository>();

            mock.Setup(s => s.GetTaskTypes(Moq.It.IsAny <string>(), Moq.It.IsAny <int>(), Moq.It.IsAny <int>())).Returns(list);

            // service
            TaskTypeService taskTypeService = new TaskTypeService();

            TaskTypeService.Repository = mock.Object;

            // Act
            var         resultList = taskTypeService.GetTaskTypes(searchTerm, pageIndex, pageSize);
            TaskTypeDTO result     = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.TaskTypeId);
            Assert.AreEqual(10, resultList.Count);
        }
Beispiel #6
0
        public int AddTaskType(TaskTypeDTO dto)
        {
            int id = 0;

            try
            {
                log.Debug(TaskTypeDTO.FormatTaskTypeDTO(dto));

                R_TaskType t = TaskTypeDTO.ConvertDTOtoEntity(dto);

                // add
                id             = Repository.AddTaskType(t);
                dto.TaskTypeId = id;

                log.Debug("result: 'success', id: " + id);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }

            return(id);
        }
Beispiel #7
0
        public void GetTaskTypes_Success_Test()
        {
            // Arrange
            R_TaskType taskType = SampleTaskType(1);

            IList <R_TaskType> list = new List <R_TaskType>();

            list.Add(taskType);

            // create mock for repository
            var mock = new Mock <ITaskTypeRepository>();

            mock.Setup(s => s.GetTaskTypes()).Returns(list);

            // service
            TaskTypeService taskTypeService = new TaskTypeService();

            TaskTypeService.Repository = mock.Object;

            // Act
            var         resultList = taskTypeService.GetTaskTypes();
            TaskTypeDTO result     = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.TaskTypeId);
        }
Beispiel #8
0
        public TaskTypeDTO GetTaskType(int taskTypeId)
        {
            try
            {
                //Requires.NotNegative("taskTypeId", taskTypeId);

                log.Debug("taskTypeId: " + taskTypeId + " ");

                // get
                R_TaskType t = Repository.GetTaskType(taskTypeId);

                TaskTypeDTO dto = new TaskTypeDTO(t);

                log.Debug(TaskTypeDTO.FormatTaskTypeDTO(dto));

                return(dto);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
        public static TaskType CopyFromDTO(TaskTypeDTO TaskTypeDTO)
        {
            var taskType = new TaskType();

            taskType.ID   = TaskTypeDTO.ID;
            taskType.Name = TaskTypeDTO.Name;

            return(taskType);
        }
Beispiel #10
0
 public TaskTypeViewModel(TaskTypeDTO t)
 {
     TaskTypeId  = t.TaskTypeId;
     Name        = t.Name;
     Description = t.Description;
     Active      = t.Active;
     IsDeleted   = t.IsDeleted;
     CreateBy    = t.CreateBy;
     CreateOn    = t.CreateOn;
     UpdateBy    = t.UpdateBy;
     UpdateOn    = t.UpdateOn;
 }
        public async Task <ActionResult> ModifyTaskType([FromBody] TaskTypeDTO taskType)
        {
            if (TaskTypeExists(taskType.TypeID))
            {
                // Call BLL TaskType Modify method with all the parameters
                object BLLResponse = new TaskTypeBLL(_context).ModifyTaskTypeBLL(taskType: taskType);

                if (BLLResponse.GetType().BaseType == typeof(Exception))
                {
                    // Create log entries for Debug log
                    ((APIException)BLLResponse).Exceptions.ForEach(ex => Logger.Msg <TaskTypesController>((Exception)ex, Serilog.Events.LogEventLevel.Debug));

                    // Return response from API
                    return(BadRequest(new { errors = ((APIException)BLLResponse).Exceptions.Select(x => x.Message).ToArray() }));
                }
                else
                {
                    try
                    {
                        TaskTypeDTO modTaskType = (TaskTypeDTO)BLLResponse;

                        // Find the existing record based on ID
                        TaskType currentRecord = _context.TaskTypes.Where(x => x.TypeID == modTaskType.TypeID).First();

                        // Modify the record
                        currentRecord.Description = modTaskType.Description;

                        // Save changes
                        await _context.SaveChangesAsync();

                        Logger.Msg <TaskTypesController>($"[{User.FindFirstValue("email")}] [MODIFY] TypeID: {currentRecord.TypeID} successful", Serilog.Events.LogEventLevel.Information);

                        // Return modified record as a DTO
                        TaskTypeDTO response = new TaskTypeDTO(currentRecord);
                        return(Ok(response));
                    }
                    catch (Exception ex)
                    {
                        // Local log entry. Database reconciliation issues are more serious so reported as Error
                        Logger.Msg <TaskTypesController>($"[MODIFY] Database sync error {ex.Message}", Serilog.Events.LogEventLevel.Error);

                        // Return response to client
                        return(StatusCode(500, new { errors = "Database update failed. Contact the administrator to resolve this issue." }));
                    }
                }
            }
            else
            {
                return(NotFound());
            }
        } // End of ModifyTaskType
Beispiel #12
0
        public TaskTypeDTO UpdateDTO(TaskTypeDTO dto, int?updateBy)
        {
            if (dto != null)
            {
                dto.TaskTypeId  = this.TaskTypeId;
                dto.Name        = this.Name;
                dto.Description = this.Description;
                dto.Active      = this.Active;
                dto.IsDeleted   = this.IsDeleted;

                dto.UpdateBy = updateBy;
                dto.UpdateOn = System.DateTime.UtcNow;
            }

            return(dto);
        }
 public TaskDetailsModel(string id_task)
 {
     task          = taskProvider.getTask(id_task).Result;
     this.stageDTO = processManagmentProvider.getStage(task.stage_id).Result;
     createdBy     = userProvider.getUserbyID(task.createdBy).Result;
     taskState     = taskProvider.getTaskState(task.taskState_id).Result;
     taskType      = taskProvider.getTaskType(task.type_id).Result;
     if (taskType.needConfirm == "True")
     {
         taskResponsablesModel = new TaskResponsablesModel(task);
     }
     if (taskType.formNeeded == "True")
     {
         formQuestionsModel = new FormQuestionsModel(task);
     }
 }
Beispiel #14
0
        public void GetTaskTypeListAdvancedSearch_Success_Test()
        {
            // Arrange
            string name        = null;
            string description = null;
            bool?  active      = null;

            //int pageIndex = 0;
            int pageSize = 10;

            // list
            IList <R_TaskType> list = new List <R_TaskType>();

            for (int i = 1; i <= pageSize; i++)
            {
                list.Add(SampleTaskType(i));
            }

            // create mock for repository
            var mock = new Mock <ITaskTypeRepository>();

            mock.Setup(s => s.GetTaskTypeListAdvancedSearch(
                           Moq.It.IsAny <string>()   // name
                           , Moq.It.IsAny <string>() // description
                           , Moq.It.IsAny <bool?>()  // active
                           )).Returns(list);

            // service
            TaskTypeService taskTypeService = new TaskTypeService();

            TaskTypeService.Repository = mock.Object;

            // Act
            var resultList = taskTypeService.GetTaskTypeListAdvancedSearch(
                name
                , description
                , active
                );

            TaskTypeDTO result = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.TaskTypeId);
        }
Beispiel #15
0
        public async Task <TaskTypeDTO> getTaskType(string id_taskType)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(_BaseAddress);
                TaskTypeDTO task = new TaskTypeDTO();
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", getToken());
                HttpResponseMessage response = client.GetAsync("api/tasks/taskTypes?id_taskType=" + id_taskType).Result;
                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();

                    task = new JavaScriptSerializer().Deserialize <TaskTypeDTO>(result);
                }
                return(task);
            }
        }
        public async Task <ActionResult> AddTaskType(string description)
        {
            // Call BLL TaskType Add method with all the parameters
            object BLLResponse = new TaskTypeBLL(_context).AddTaskTypeBLL(description: description);

            // Get the base class for the response
            // Ref: https://docs.microsoft.com/en-us/dotnet/api/system.type.basetype?view=netcore-3.1
            if (BLLResponse.GetType().BaseType == typeof(Exception))
            {
                // Create log entries for Debug log
                ((APIException)BLLResponse).Exceptions.ForEach(ex => Logger.Msg <TaskTypesController>((Exception)ex, Serilog.Events.LogEventLevel.Debug));

                // Return response from API
                return(BadRequest(new { errors = ((APIException)BLLResponse).Exceptions.Select(x => x.Message).ToArray() }));
            }
            else
            {
                try
                {
                    TaskType newTaskType = new TaskType {
                        Description = ((TaskTypeDTO)BLLResponse).Description
                    };

                    // Create the record
                    _context.TaskTypes.Add(newTaskType);
                    await _context.SaveChangesAsync();

                    Logger.Msg <TaskTypesController>($"[{User.FindFirstValue("email")}] [ADD] TaskType '{description}' successful", Serilog.Events.LogEventLevel.Information);

                    // Convert back to DTO and return to user
                    TaskTypeDTO response = new TaskTypeDTO(newTaskType);
                    return(Ok(response));
                }
                catch (Exception ex)
                {
                    // Local log entry. Database reconciliation issues are more serious so reported as Error
                    Logger.Msg <TaskTypesController>($"[ADD] Database sync error {ex.Message}", Serilog.Events.LogEventLevel.Error);

                    // Return response to client
                    return(StatusCode(500, new { errors = "Database update failed. Contact the administrator to resolve this issue." }));
                }
            }
        } // End of AddTaskType
        public static TaskTypeDTO getTaskType(string id_taskType)
        {
            TaskTypeDTO taskType = new TaskTypeDTO();

            using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionRRHHDatabase"].ConnectionString))
            {
                SqlCommand command = new SqlCommand("usp_get_taskType", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add("@id_taskType", SqlDbType.Int);
                command.Parameters["@id_taskType"].Value = id_taskType;
                command.Connection.Open();
                SqlDataReader rdr = command.ExecuteReader();
                while (rdr.Read())
                {
                    taskType.taskName    = rdr["taskName"].ToString();
                    taskType.needConfirm = rdr["needConfirm"].ToString();
                    taskType.formNeeded  = rdr["formNeeded"].ToString();
                }
            };
            return(taskType);
        }
Beispiel #18
0
        public void UpdateTaskType_Success_Test()
        {
            // Arrange
            TaskTypeDTO dto = SampleTaskTypeDTO(1);

            // create mock for repository
            var mock = new Mock <ITaskTypeRepository>();

            mock.Setup(s => s.UpdateTaskType(Moq.It.IsAny <R_TaskType>())).Verifiable();

            // service
            TaskTypeService taskTypeService = new TaskTypeService();

            TaskTypeService.Repository = mock.Object;

            // Act
            taskTypeService.UpdateTaskType(dto);

            // Assert
            Assert.IsNotNull(dto);
        }
Beispiel #19
0
        public int UpdateTask(TaskTypeDTO ttdto, string index)
        {
            int sendBack = 0;

            using (var connection = new SqlConnection(@"Data Source=db-mssql;Initial Catalog=s19342;Integrated Security=True"))
            {
                connection.Open();
                var tran = connection.BeginTransaction();

                try
                {
                    using (var command = new SqlCommand())
                    {
                        command.Connection  = connection;
                        command.Transaction = tran;

                        command.CommandText = @"Update Task
                                                Set Name=@name, Descrption=@desc, Deadline=@dead,IdProject=@idp,idAssignedTo=@ida, IdCreator=@idc, IdTaskType=@idt
                                                Where IdTask=@index";
                        command.Parameters.AddWithValue("@name", ttdto.Name);
                        command.Parameters.AddWithValue("@desc", ttdto.Description);
                        command.Parameters.AddWithValue("@dead", ttdto.Deadline);
                        command.Parameters.AddWithValue("@idp", ttdto.IdProject);
                        command.Parameters.AddWithValue("@ida", ttdto.IdAssignedTo);
                        command.Parameters.AddWithValue("@idc", ttdto.IdCreator);
                        command.Parameters.AddWithValue("@idt", ttdto.TaskTypeGiven.IdTaskType);
                        command.Parameters.AddWithValue("@index", index);

                        command.ExecuteNonQuery();
                        tran.Commit();
                        return(1);
                    }
                }
                catch (SqlException e)
                {
                    tran.Rollback();
                    return(0);
                }
            }
        }
Beispiel #20
0
        private TaskTypeDTO Update(TaskTypeViewModel viewModel)
        {
            try
            {
                log.Debug(TaskTypeViewModel.FormatTaskTypeViewModel(viewModel));

                // get
                log.Debug("_taskTypeService.GetTaskType - taskTypeId: " + viewModel.TaskTypeId + " ");

                var existingTaskType = _taskTypeService.GetTaskType(viewModel.TaskTypeId);

                log.Debug("_taskTypeService.GetTaskType - " + TaskTypeDTO.FormatTaskTypeDTO(existingTaskType));

                if (existingTaskType != null)
                {
                    // copy values
                    viewModel.UpdateDTO(existingTaskType, null); //RequestContext.Principal.Identity.GetUserId());

                    // update
                    log.Debug("_taskTypeService.UpdateTaskType - " + TaskTypeDTO.FormatTaskTypeDTO(existingTaskType));

                    _taskTypeService.UpdateTaskType(existingTaskType);

                    log.Debug("result: 'success'");
                }
                else
                {
                    log.Error("existingTaskType: null, TaskTypeId: " + viewModel.TaskTypeId);
                }

                return(existingTaskType);
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
        public static List <TaskTypeDTO> getTaskTypes()
        {
            List <TaskTypeDTO> taskTypes = new List <TaskTypeDTO>();

            using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionRRHHDatabase"].ConnectionString))
            {
                SqlCommand command = new SqlCommand("usp_get_taskTypes", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Connection.Open();
                SqlDataReader rdr = command.ExecuteReader();
                while (rdr.Read())
                {
                    TaskTypeDTO taskType = new TaskTypeDTO();
                    taskType.id_taskType = rdr["id_taskType"].ToString();
                    taskType.taskName    = rdr["taskName"].ToString();
                    taskType.needConfirm = rdr["needConfirm"].ToString();
                    taskType.formNeeded  = rdr["formNeeded"].ToString();
                    taskTypes.Add(taskType);
                }
            };
            return(taskTypes);
        }
Beispiel #22
0
        public void DeleteTaskType(TaskTypeDTO dto)
        {
            try
            {
                log.Debug(TaskTypeDTO.FormatTaskTypeDTO(dto));

                R_TaskType t = TaskTypeDTO.ConvertDTOtoEntity(dto);

                // delete
                Repository.DeleteTaskType(t);
                dto.IsDeleted = t.IsDeleted;

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Beispiel #23
0
        public void AddTaskType_Success_Test()
        {
            // Arrange
            TaskTypeDTO dto = SampleTaskTypeDTO(1);

            // create mock for repository
            var mock = new Mock <ITaskTypeRepository>();

            mock.Setup(s => s.AddTaskType(Moq.It.IsAny <R_TaskType>())).Returns(1);

            // service
            TaskTypeService taskTypeService = new TaskTypeService();

            TaskTypeService.Repository = mock.Object;

            // Act
            int id = taskTypeService.AddTaskType(dto);

            // Assert
            Assert.AreEqual(1, id);
            Assert.AreEqual(1, dto.TaskTypeId);
        }
Beispiel #24
0
        public void GetTaskType_Success_Test()
        {
            // Arrange
            int        id       = 1;
            R_TaskType taskType = SampleTaskType(id);

            // create mock for repository
            var mock = new Mock <ITaskTypeRepository>();

            mock.Setup(s => s.GetTaskType(Moq.It.IsAny <int>())).Returns(taskType);

            // service
            TaskTypeService taskTypeService = new TaskTypeService();

            TaskTypeService.Repository = mock.Object;

            // Act
            TaskTypeDTO result = taskTypeService.GetTaskType(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.TaskTypeId);
        }
Beispiel #25
0
        public void UpdateTaskType(TaskTypeDTO dto)
        {
            try
            {
                //Requires.NotNull(t);
                //Requires.PropertyNotNegative(t, "TaskTypeId");

                log.Debug(TaskTypeDTO.FormatTaskTypeDTO(dto));

                R_TaskType t = TaskTypeDTO.ConvertDTOtoEntity(dto);

                // update
                Repository.UpdateTaskType(t);

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
        public TaskTypeDTO getTaskType(string id_taskType)
        {
            TaskTypeDTO taskType = TaskData.getTaskType(id_taskType);

            return(taskType);
        }
 public ActionResult _AddTask(Model.AddTaskModel model)
 {
     if (ModelState.IsValid)
     {
         List <TaskDTO> tasks   = taskProvider.getTasks(model.id_stage).Result;
         TaskDTO        taskDTO = new TaskDTO();
         taskDTO.name        = model.name;
         taskDTO.description = model.description;
         taskDTO.stage_id    = model.id_stage;
         taskDTO.type_id     = model.selected_taskType;
         if (tasks.Count == 0)
         {
             taskDTO.taskPosition = "0";
         }
         else
         {
             taskDTO.taskPosition = (Int32.Parse(tasks[tasks.Count - 1].taskPosition) + 1).ToString();
         }
         if (model.timeSelected == "time")
         {
             taskDTO.daysAvailable  = model.daysAmount;
             taskDTO.hoursAvailable = model.hoursAmount;
         }
         else if (model.timeSelected == "date")
         {
             taskDTO.finishDate = model.timeDatePicker + " " + model.timeHour;
         }
         taskDTO.userLog = Request.Cookies["user_id"].Value;
         string id_task;
         if ((id_task = taskProvider.postTask(taskDTO).Result) != null)
         {
             id_task = id_task.Replace("\"", "");
             bool        isSuccess = false;
             TaskTypeDTO taskType  = taskProvider.getTaskType(taskDTO.type_id).Result;
             if (taskType.formNeeded == "True")
             {
                 TaskFormDTO taskForm = new TaskFormDTO();
                 taskForm.id_task     = id_task;
                 taskForm.description = "";
                 taskForm.userLog     = taskDTO.userLog;
                 if (taskProvider.postTaskForm(taskForm).Result)
                 {
                     isSuccess = true;
                 }
             }
             else
             {
                 isSuccess = true;
             }
             if (isSuccess)
             {
                 StageDTO stageDTO = new ProcessManagmentProvider().getStage(taskDTO.stage_id).Result;
                 if (taskProvider.putRefreshTaskTimes(stageDTO.processManagment_id).Result)
                 {
                     var result = new { id_task = id_task, viewHtml = PartialView("/Views/Tasks/_Tasks/_TasksList.cshtml", new Model.TasksModel(taskDTO.stage_id)).RenderToString() };
                     return(Json(result));
                 }
             }
         }
     }
     return(new HttpStatusCodeResult(404, "Can't find that"));
 }