public async Task <IActionResult> OnGetAsync(Delete.Query query) { Model = await mediator.Send(query); Command = new Delete.Command { Id = Model.Id }; return(Page()); }
// GET: /Student/Delete/5 public async Task <ActionResult> Delete(Delete.Query query) { var student = await _mediator.SendAsync(query); if (student == null) { return(HttpNotFound()); } return(View(student)); }
public async Task <ActionResult> DeleteAsync(Delete.Query query) { var result = await _mediator.Send(query); if (result == null) { return(NotFound(query.Id)); } return(View(result)); }
public async Task Should_get_delete_details() { var cmd = new Create.Command { FirstMidName = "Joe", LastName = "Schmoe", EnrollmentDate = DateTime.Today }; var studentId = await SendAsync(cmd); var query = new Delete.Query { Id = studentId }; var result = await SendAsync(query); result.FirstMidName.ShouldBe(cmd.FirstMidName); result.LastName.ShouldBe(cmd.LastName); result.EnrollmentDate.ShouldBe(cmd.EnrollmentDate.GetValueOrDefault()); }
public async Task <IActionResult> DeleteAsync(Delete.Query query) { return(View(await _mediator.Send(query))); }