Ejemplo n.º 1
0
        public void AddTask(CommonEntities.Tasks task)
        {
            ProjectManagerEntities mockContext = MockDataSetList();
            var taskBL = new TaskBL(mockContext);

            taskBL.AddTask(task);
        }
        //[Route("AddTask")]
        public IHttpActionResult Post(Task item)
        {
            TaskBL obj = new TaskBL();

            obj.AddTask(item);
            return(Ok());
        }
        public IHttpActionResult AddTask(Task item)
        {
            TaskBL obj = new TaskBL();

            obj.AddTask(item);
            return(Ok("Task Added!!"));
        }
Ejemplo n.º 4
0
        public IHttpActionResult Post(Task item)
        {
            TaskBL ts = new TaskBL();

            ts.AddTask(item);
            return(Ok("Record added"));
        }
Ejemplo n.º 5
0
        //Testing Purpose

        public IHttpActionResult POST(Entities.Task task)
        {
            TaskBL obj = new TaskBL();

            obj.AddTask(task);
            return(Ok("Task is Added"));
        }
Ejemplo n.º 6
0
        public IHttpActionResult AddTask(Task task)
        {
            var taskBL = new TaskBL(_context);

            taskBL.AddTask(task);
            return(Ok());
        }
Ejemplo n.º 7
0
 public IHttpActionResult Post([FromBody] Task item)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest("Invalid data."));
     }
     bl.AddTask(item);
     return(Ok());
 }
        public void Test_D_AddTask()
        {
            Task item = new Task()
            {
                TaskId = 100, ParentId = 1, ProjectId = 1003, UserId = 2, TaskName = "PerfTestTask", ParentTask = "Task 10", Priority = 2, SDate = DateTime.Now, EDate = DateTime.Now, Status = "Started", TaskEndFlag = true
            };
            TaskBL obj = new TaskBL();

            obj.AddTask(item);
        }
Ejemplo n.º 9
0
        public void Test_D_AddTask()
        {
            Task item = new Task()
            {
                TaskId = 100, TaskName = "PerfTestTask", ParentTask = "Task11", Priority = 2, SDate = DateTime.Now, EDate = DateTime.Now, TaskEndFlag = true
            };
            TaskBL obj = new TaskBL();

            obj.AddTask(item);
        }
Ejemplo n.º 10
0
        public IHttpActionResult Post(Task task)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            TaskBL obj = new TaskBL();

            obj.AddTask(task);
            return(Ok(task.TaskId.ToString()));
        }
Ejemplo n.º 11
0
        public void Add()
        {
            var id = taskBL.AddTask(new Task
            {
                Title     = "Test task2",
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now,
                ProjectId = 1
            });

            Assert.True(id > 0);
        }
Ejemplo n.º 12
0
 // POST api/<controller>
 public HttpResponseMessage Post([FromBody] TaskTableData taskData)
 {
     try
     {
         tmBL.AddTask(taskData);
         return(Request.CreateResponse(HttpStatusCode.OK, "success"));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex));
     }
 }
Ejemplo n.º 13
0
        public void AddTask()
        {
            TaskBL obje  = new TaskBL();
            int    count = obje.GetTask().Count();
            //dynamic testtask = new (Task) list<Task>;
            Task T = (new Task {
                ParentName = "ParentTaskstest", TaskName = "Testtaskname", Priority = 15, SDate = DateTime.Now, EDate = DateTime.Now
            });

            obje.AddTask(T);
            int count1 = obje.GetTask().Count();

            Assert.AreEqual(count1, count + 1);
        }
        public IHttpActionResult AddTask(Task item)
        {
            TaskBL blTask = new TaskBL();

            try
            {
                blTask.AddTask(item);
            }
            catch (Exception ex)
            {
                return(Ok(ex.Message));
            }
            return(Ok());
        }
        public void Test_D_AddTask()
        {
            Task item = new Task()
            {
                TaskId = 100, TaskName = "TestTask", ParentTask = "Task11", Priority = 2, SDate = DateTime.Now, EDate = DateTime.Now, TaskEndFlag = true
            };
            TaskBL obj = new TaskBL();

            obj.AddTask(item);
            var res = obj.GetByName("TestTask");

            if (res != null)
            {
                AddDelTestId = res.TaskId;
            }
            Assert.IsNotNull(res);
        }
Ejemplo n.º 16
0
        public void AddTaskTest()
        {
            Mock <TaskDBEntities> mockContext = MockDataSetList();
            var  taskManagerBL = new TaskBL(mockContext.Object);
            Task model         = new Task()
            {
                Task_ID    = 1,
                TaskName   = "Task 1",
                Parent_ID  = 1,
                Priority   = 10,
                Start_Date = DateTime.Now.Date,
                End_Date   = DateTime.Now.AddDays(10)
            };
            int result = taskManagerBL.AddTask(model);

            Assert.IsTrue(result == 0);
        }
Ejemplo n.º 17
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 void Test_F_AddTask()
        {
            //Task item = new Task() { TaskId = 100, TaskName = "TestTask", ParentTask = "Task11", Priority = 2, SDate = DateTime.Now, EDate = DateTime.Now, TaskEndFlag = true };
            Task item = new Task()
            {
                TaskId = 1000, ParentId = 1, ProjectId = 1003, UserId = 2, TaskName = "UnitTestTask", ParentTask = "Task 10", Priority = 2, SDate = DateTime.Now, EDate = DateTime.Now, Status = "Started", TaskEndFlag = true
            };
            TaskBL obj = new TaskBL();

            obj.AddTask(item);
            var res = obj.GetByName("UnitTestTask");

            if (res != null)
            {
                AddDelTestId = res.TaskId;
            }
            Assert.IsNotNull(res);
        }
Ejemplo n.º 19
0
        public void TestAddTask()
        {
            Random randm = new Random();
            int    rand  = randm.Next(1, 10000);


            string TaskName1 = "Test2" + rand.ToString();

            TaskManager.BusinessLib.TaskBL obj = new TaskBL();

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

            TaskManager.Entities.Task t = obj.GetTaskByName(TaskName1);
            Assert.AreEqual(TaskName1, t.TaskName);
        }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            try
            {
                string input;
                Console.WriteLine("Select the Action No.");
                Console.WriteLine("1.Add Task");
                Console.WriteLine("2.Update Task");
                Console.WriteLine("3.Search Task");
                Console.WriteLine("4.Delete Task");
                Console.WriteLine("5.Exit");
                input = Console.ReadLine();
                TaskBL obj = new TaskBL();
                switch (input)
                {
                case "1":
                    obj.AddTask(new TaskManager.Entities.Task()
                    {
                        TaskId = 2, TaskName = "Task22", ParentTask = "Task11", Priority = 2, SDate = DateTime.Now, EDate = DateTime.Now, TaskEndFlag = true
                    });
                    break;

                case "2":
                    Console.WriteLine("Enter Task Id");
                    string ID_Update = Console.ReadLine();
                    TaskManager.Entities.Task TskUpdate = obj.GetById(Convert.ToInt32(ID_Update));
                    Console.WriteLine("Task Details Before Update:");
                    Console.WriteLine("Task ID : " + TskUpdate.TaskId.ToString() + "\n"
                                      + "Task Name : " + TskUpdate.TaskName.ToString() + "\n"
                                      + "Priority : " + TskUpdate.Priority.ToString() + "\n");
                    Console.WriteLine("Enter New TaskName");
                    TskUpdate.TaskName = Console.ReadLine();
                    obj.UpdateTask(TskUpdate);
                    TskUpdate = obj.GetById(Convert.ToInt32(ID_Update));
                    Console.WriteLine("Task Details After Update:");
                    Console.WriteLine("Task ID : " + TskUpdate.TaskId.ToString() + "\n"
                                      + "Task Name : " + TskUpdate.TaskName.ToString() + "\n"
                                      + "Priority : " + TskUpdate.Priority.ToString() + "\n");
                    Console.ReadLine();
                    break;

                case "3":
                    Console.WriteLine("Enter Task Id to Search");
                    String ID = Console.ReadLine();
                    TaskManager.Entities.Task TskSearch = obj.GetById(Convert.ToInt32(ID));
                    Console.WriteLine("Task Details:");
                    Console.WriteLine("Task ID : " + TskSearch.TaskId.ToString() + "/n"
                                      + "Task Name : " + TskSearch.TaskName.ToString() + "/n"
                                      + "Priority : " + TskSearch.Priority.ToString() + "/n"
                                      );
                    break;

                case "4":
                    Console.WriteLine("Enter Task Id to Delete");
                    String ID_Del = Console.ReadLine();
                    obj.DeleteTask(Convert.ToInt32(ID_Del));
                    break;

                case "5":
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadLine();
            }
        }
Ejemplo n.º 21
0
 public JsonResult AddTask(Task task)
 {
     return(Json(taskBL.AddTask(task)));
 }
Ejemplo n.º 22
0
 public bool AddTask(object taskModel)
 {
     _taskBL = new TaskBL();
     _taskBL.AddTask(taskModel);
     return(true);
 }