//Controller is used to get Tasks using ID public IActionResult TaskDetail(int id) { var output = _taskAppService.GetTaskById(id); var model = new GetTaskByIdModel(output); return(View(model)); }
public ActionResult GetTask() { var data = _taskAppService.GetTaskById(1); TempData["Title"] = data.Title; return(RedirectToAction("Index")); }
public async void Should_Get_Task_By_Id() { //Arrange var defaultTask = UsingDbContext(ctx => ctx.Tasks.FirstOrDefault()); //Act var task = _taskAppService.GetTaskById(defaultTask.Id); var task2 = await _taskAppService.GetTaskByIdAsync(defaultTask.Id); //Assert task.ShouldNotBeNull(); task.Title.ShouldBeSameAs(defaultTask.Title); task2.ShouldNotBeNull(); task2.Title.ShouldBeSameAs(defaultTask.Title); }
// GET: Tasks/Edit/5 public PartialViewResult Edit(int id) { var task = _taskAppService.GetTaskById(id); var updateTaskDto = Mapper.Map <UpdateTaskInput>(task); var userList = _userAppService.GetUsers(); ViewBag.AssignedPersonId = new SelectList(userList.Items, "Id", "Name", updateTaskDto.AssignedPersonId); return(PartialView("_EditTask", updateTaskDto)); }