public async Task <IActionResult> Remove(Guid id) { var result = await _bo.DeleteAsync(id); if (!result.Success) { return(InternalServerError(result.Exception)); } return(Ok()); }
public void TestDeleteMenuAsync() { RestaurantSeeder.Seed(); var bo = new MenuBusinessObject(); var resList = bo.ListAsync().Result; var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result; var total = resList.Result.Count; resList = bo.ListNonDeletedAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == total - 1); }
public void TestDeleteMenuAsync() { ContextSeeders.Seed(); var bo = new MenuBusinessObject(); var resList = bo.List(); var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result; resList = bo.ListAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted); }
public async Task <IActionResult> Delete(Guid?id) { if (id == null) { return(RecordNotFound()); } var deleteOperation = await _bo.DeleteAsync((Guid)id); if (!deleteOperation.Success) { return(OperationErrorBackToIndex(deleteOperation.Exception)); } else { return(OperationSuccess("The record was successfuly deleted")); } }