public TaskModel GetTaskById(int taskId) { _taskBL = new TaskBL(); var result = _taskBL.GetTaskById(taskId); return(result); }
public IHttpActionResult GetTaskByID(long id) { var taskData = taskBL.GetTaskById(id); if (taskData == null) { return(NotFound()); } return(Ok(taskData)); }
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); }
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); }
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))); }