コード例 #1
0
ファイル: TestBL.cs プロジェクト: firoshkhan/TaskManagerSever
        public void TestGetAlltasks()
        {
            TaskManager.BusinessLib.TaskBL obj = new TaskBL();
            int Count = obj.GetAllTasks().Count;

            Assert.Greater(Count, 0);
        }
コード例 #2
0
 public void Benchmark(BenchmarkContext context)
 {
     // _counter.Increment();
     //  var bytes = new byte[0];
     TaskManager.BusinessLib.TaskBL obj = new TaskBL();
     int Count = obj.GetAllTasks().Count;
 }
コード例 #3
0
        public IHttpActionResult DeleteTask(int taskId)
        {
            TaskBL blTask = new TaskBL();

            try
            {
                blTask.DeleteTask(taskId);
            }
            catch (Exception ex)
            {
                return(Ok(ex.Message));
            }
            return(Ok(blTask.GetAllTasks()));
        }
コード例 #4
0
        static void Main(string[] args)
        {
            try
            {
                TaskBL obj = new TaskBL();
                Task   t   = obj.GetTaskById(2);
                t.TaskName = "new task";
                obj.UpdateTask(t);

                List <Task> ts = obj.GetAllTasks();

                /*   foreach ( Task t in ts)
                 *     {
                 *     Console.WriteLine("amount is {0}, and type is {1}", t.TaskId, t.TaskName);
                 * }*/

                obj.AddTask(new TaskManager.Entities.Task()
                {
                    TaskId    = 2,
                    TaskName  = "Testdfgdgdg2",
                    Startdate = DateTime.Now,
                    Enddate   = DateTime.Now,
                    Priority  = 10
                }
                            );

                /*
                 * obj.AddTask(new TaskManager.Entities.Task()
                 * {
                 *   TaskId = 3,
                 *   TaskName = "Test3",
                 *   Startdate = DateTime.Now,
                 *   Enddate = DateTime.Now,
                 *   Priority = 10,
                 *
                 *   TaskParentId = 2
                 *
                 * }
                 * );*/
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #5
0
        public IHttpActionResult GetAllTasks()
        {
            var taskBL   = new TaskBL(_context);
            var allTasks = taskBL.GetAllTasks();
            var tasks    = (from ts in allTasks
                            from pts in allTasks
                            .Where(x => x.TaskId == ts.ParentId)
                            .DefaultIfEmpty()
                            select new
            {
                TaskId = ts.TaskId,
                TaskName = ts.TaskName,
                Priority = ts.Priority,
                StartDate = ts.StartDate.ToString("dd-MM-yyyy"),
                EndDate = ts.EndDate.ToString("dd-MM-yyyy"),
                ParentTaskName = pts?.TaskName,
                EndTask = ts.EndTask
            }).ToList();

            return(Ok(tasks));
        }
コード例 #6
0
        public IHttpActionResult GetAllTasks()
        {
            var         taskBL   = new TaskBL(_context);
            List <Task> allTasks = new List <Task>();

            try
            {
                allTasks = taskBL.GetAllTasks();
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
            finally
            {
                taskBL = null;
            }

            var tasks = (from ts in allTasks
                         from pts in allTasks
                         .Where(x => x.TaskId == ts.ParentId)
                         .DefaultIfEmpty()
                         select new
            {
                TaskId = ts.TaskId,
                TaskName = ts.TaskName,
                Priority = ts.Priority,
                StartDate = ts.StartDate.ToString("dd-MM-yyyy"),
                EndDate = ts.EndDate.ToString("dd-MM-yyyy"),
                ParentTaskName = pts?.TaskName,
                EndTask = ts.EndTask,
                IsParent = ts.IsParent
            }).ToList();

            return(Ok(tasks));
        }
コード例 #7
0
        public async Task <IHttpActionResult> All()
        {
            TaskBL wl = new TaskBL();

            return(Ok(wl.GetAllTasks()));
        }
コード例 #8
0
        public IHttpActionResult Get()
        {
            TaskBL obj = new TaskBL();

            return(Ok(obj.GetAllTasks()));
        }
コード例 #9
0
        public IHttpActionResult GetAllTasks()
        {
            TaskBL blTask = new TaskBL();

            return(Ok(blTask.GetAllTasks()));
        }