示例#1
0
        public TaskManagerDetails GetTaskManagerById(int TaskID)
        {
            TaskManagerDetails taskManager = new TaskManagerDetails();

            taskManager = null;//TaskDbContext.TaskManagerList.Find(t => t.Task_ID == TaskID);
            return(taskManager);
        }
示例#2
0
        public bool EditTaskManagerById([FromBody] TaskManagerDetails TaskManager)
        {
            try
            {
                using (var task = new TaskManagerBal())
                {
                    return(task.UpdateTask(TaskManager));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //TaskManagerDetails taskDetails = TaskDbContext.TaskManagerList.Find(t => t.Task_ID == TaskManager.Task_ID);

            //if (taskDetails != null)
            //{

            //}
            //else
            //{

            //}
            //return false;
        }
        //private ITaskRepository<object> taskRepo;

        //public TaskManagerBal(ITaskRepository<object> repos)
        //{
        //    this.taskRepo = repos;
        //}

        public bool AddTask(TaskManagerDetails taskDetails)
        {
            try
            {
                using (var repository = new TaskRepository())
                {
                    return(repository.AddTask(taskDetails));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public bool UpdateTask(TaskManagerDetails taskDetails)
 {
     try
     {
         using (var repository = new TaskRepository())
         {
             return(repository.UpateTask(taskDetails));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     // return true;
 }
        public void AddTask()
        {
            TaskManagerDetails taskdetails = new TaskManagerDetails()
            {
                Task        = "Add Task",
                Parent_Task = "Add Parent Task",
                Priority    = 5,
                Start_Date  = DateTime.Now,
                End_Date    = DateTime.Now
            };

            TaskManagerController taskController = new TaskManagerController();
            bool result = taskController.AddTaskManager(taskdetails);

            Assert.IsNotNull(result);
            Assert.AreEqual(true, result);
        }
示例#6
0
 public bool AddTaskManager([FromBody] TaskManagerDetails TaskManager)
 {
     try
     {
         using (var task = new TaskManagerBal())
         {
             return(task.AddTask(TaskManager));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     //bool status = false;
     //if (TaskManager != null)
     //{
     //    //TaskDbContext.TaskManagerList.Add(TaskManager);
     //    status = true;
     //}
     //return status;
 }
        public void DeleteTask()
        {
            TaskManagerDetails taskdetails = new TaskManagerDetails()
            {
                Task        = "Delete Task",
                Parent_Task = "Delete Parent Task",
                Priority    = 5,
                Start_Date  = DateTime.Now,
                End_Date    = DateTime.Now
            };

            TaskManagerController taskController = new TaskManagerController();

            taskController.AddTaskManager(taskdetails);

            List <TaskManagerDetails> resultGetTasks = taskController.GetAllTask();
            TaskManagerDetails        selectedTask   = resultGetTasks.Find(x => x.Task == "Delete Task");
            bool result = taskController.DeleteTaskManagerById(selectedTask.Task_ID);

            Assert.IsNotNull(result);
            Assert.AreEqual(true, result);
        }
        public void GetTask()
        {
            TaskManagerDetails taskdetails = new TaskManagerDetails()
            {
                Task        = "New Task",
                Parent_Task = "New Parent Task",
                Priority    = 5,
                Start_Date  = DateTime.Now,
                End_Date    = DateTime.Now
            };

            //TaskManagerBal taskBal = new TaskManagerBal();
            TaskManagerController taskController = new TaskManagerController();

            taskController.AddTaskManager(taskdetails);
            //taskBal.AddTask(taskdetails);

            List <TaskManagerDetails> result = taskController.GetAllTask();

            Assert.IsNotNull(result);
            Assert.GreaterOrEqual(result.Count, 1);
        }