示例#1
0
        public TaskModel GetTaskById(int taskId)
        {
            _taskBL = new TaskBL();
            var result = _taskBL.GetTaskById(taskId);

            return(result);
        }
示例#2
0
        public IHttpActionResult GetTaskByID(long id)
        {
            var taskData = taskBL.GetTaskById(id);

            if (taskData == null)
            {
                return(NotFound());
            }

            return(Ok(taskData));
        }
示例#3
0
        public void TestUpdTask()
        {
            string TaskName = "Test updated";

            TaskManager.BusinessLib.TaskBL obj = new TaskBL();
            TaskManager.Entities.Task      t   = obj.GetTaskById(1);
            t.TaskName = "Test updated";
            obj.UpdateTask(t);

            TaskManager.Entities.Task t1 = obj.GetTaskByName(TaskName);
            Assert.AreEqual(t.TaskName, t1.TaskName);
        }
示例#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);
            }
        }
        public IHttpActionResult Delete(int TaskId)
        {
            TaskBL obj  = new TaskBL();
            Task   task = obj.GetTaskById(TaskId);

            if (task == null)
            {
                var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
                {
                    Content      = new StringContent(string.Format("No task  with ID = {0}", TaskId)),
                    ReasonPhrase = "Task ID Not Found"
                };
                throw new HttpResponseException(resp);
            }

            obj.DeleteTask(TaskId);
            return(Ok("Task Deleted Sucessfully"));
        }
        public void GetById()
        {
            var task = taskBL.GetTaskById(1);

            Assert.NotNull(task);
        }
示例#7
0
 public void TestGetTaskbyID()
 {
     TaskManager.BusinessLib.TaskBL obj = new TaskBL();
     TaskManager.Entities.Task      t   = obj.GetTaskById(1);
     Assert.AreEqual("Test updated", t.TaskName);
 }
        public IHttpActionResult GetTasksById(int TaskId)
        {
            TaskBL obj = new TaskBL();

            return(Ok(obj.GetTaskById(TaskId)));
        }
        public IHttpActionResult GetTaskByID(int taskId)
        {
            TaskBL blTask = new TaskBL();

            return(Ok(blTask.GetTaskById(taskId)));
        }