public async Task <IActionResult> DeleteAssignmentAsync(Assignment assignment) { try { await _assignmentService.DeleteAssignmentAsync(assignment); return(Ok()); } catch (BussinessException ex) { return(StatusCode(StatusCodes.Status500InternalServerError, $"Internal server error: {ex.Message}")); } }
public void DeleteAssignment() { var task = service.GetAssignmentsAsync(CancellationToken.None); task.Wait(); var assignment = task.Result.FirstOrDefault(a => a.CompanyName != "Xamarin"); assignment.CompanyName = "New Company"; var saveTask = service.SaveAssignmentAsync(assignment, CancellationToken.None); saveTask.Wait(); var deleteTask = service.DeleteAssignmentAsync(assignment, CancellationToken.None); deleteTask.Wait(); Assert.That(deleteTask.Result, Is.EqualTo(1)); }
public async Task<IActionResult> DeleteAssignment([FromBody] List<Guid> ids) { return await _assigmentService.DeleteAssignmentAsync(ids).ConfigureAwait(false).GetObjectResponseAsync<AssignmentDTO, Guid>(ids, "Success").ConfigureAwait(false); }