示例#1
0
        public void GetTaskTestBL()
        {
            Mock <TaskManagerEntities> mockContext = MockDataSetList();
            var taskManagerBL         = new TaskManagerBL(mockContext.Object);
            Collection <TaskBL> tasks = taskManagerBL.GetTask();

            Assert.IsNotNull(tasks);
            foreach (var task in tasks)
            {
                Assert.IsNotNull(task.TaskID);
                Assert.IsNotNull(task.Task);
                Assert.IsNotNull(task.Priority);
                Assert.IsNotNull(task.StartDate);
                Assert.IsNotNull(task.EndDate);
            }
        }
示例#2
0
        public IHttpActionResult GetTasks()
        {
            Collection <TaskModel> tasks = new Collection <TaskModel>();

            var blTasks = taskManagerBL.GetTask();

            blTasks.ToList().ForEach(
                x => tasks.Add(
                    new TaskModel
            {
                TaskID     = x.TaskID,
                Task       = x.Task,
                ParentTask = x.ParentTask ?? "",
                Priority   = x.Priority,
                StartDate  = x.StartDate,
                EndDate    = x.EndDate,
                IsActive   = x.IsActive
            }));

            return(Ok(tasks));
        }
        public List <Tasks> GetTaskbyFilter(String task, String parentTask, Int16 priorityFrom, Int16 priorityTo, DateTime?startDate, DateTime?endDate)
        {
            List <Tasks> tasks = new List <Tasks>();

            try
            {
                if (startDate == null)
                {
                    startDate = DateTime.Now;
                }
                if (endDate == null)
                {
                    endDate = DateTime.Now;
                }

                tasks = taskBL.GetTask(task, parentTask, priorityFrom, priorityTo, Convert.ToDateTime(startDate), Convert.ToDateTime(endDate));
            }
            catch
            {
                return(tasks);
            }
            return(tasks);
        }