public async Task WhenDeletingExistingProduct_ThenNoContentIsReturned() { ApiResponse <ViewProduct> createResponse = await _productApiClient.Create(ProductModels.GetCreateModel()); ApiResponse <Response> deleteResponse = await _productApiClient.Delete(createResponse.Response.Id); Assert.That(deleteResponse.HttpStatusCode, Is.EqualTo(HttpStatusCode.NoContent)); }
public async Task TearDown() { if (_productIdToDelete != default(int)) { await _productApiClient.Delete(_productIdToDelete); } }
public async Task TearDown() { if (_createdProductId != default(int)) { await _productApiClient.Delete(_createdProductId); } }
public async Task<ApiResult<bool>> Delete(int id) { var result = await _productApiClient.Delete(id); if (result.IsSuccessed) { TempData["Result"] = result.Message; } return result; }
public async Task <IActionResult> Delete(int id, string pageIndex) { var result = await _productApiClient.Delete(id); if (result == null) { TempData["error"] = result.Message; return(RedirectToAction("Index", new { pageIndex = !string.IsNullOrWhiteSpace(pageIndex) ? int.Parse(pageIndex) : 1 })); } else { TempData["result"] = "Xóa sản phẩm thành công"; return(RedirectToAction("Index", new { pageIndex = !string.IsNullOrWhiteSpace(pageIndex) ? int.Parse(pageIndex) : 1 })); } }
public async Task <IActionResult> Delete(int id) { var result = await _productApiClient.Delete(id); if (result) { TempData["message"] = "Xóa sản phẩm thành công"; return(RedirectToAction("List")); } else { TempData["message"] = "Xóa sản phẩm thất bại"; return(RedirectToAction("List")); } }
public async Task <IActionResult> Delete(ProductDeleteRequest request) { if (!ModelState.IsValid) { return(View()); } var result = await _productApiClient.Delete(request.Id); if (result.IsSuccessed) { TempData["result"] = "Xóa sản phẩm thành công"; return(RedirectToAction("Index")); } ModelState.AddModelError("", result.Message); return(View(request)); }
public async Task <IActionResult> Delete(ProductDeleteRequest request) // lấy request từ thằng backeEnd thông qua thằng UserApiClient { if (!ModelState.IsValid) { return(View()); } var result = await _productApiClient.Delete(request.Id);// với id lấy về trên kia trong request và thực hiện xóa if (result) { // khi thành công ta có thể tạo một TempData đây là đầu đi và sẽ có đầu nhận dữ liệu này nhe bên View Của nó TempData["result"] = "Xóa Thành Công"; //có key là result return(RedirectToAction("Index")); // nếu thành công thì chuyển tới phân trang là Index } return(View(request));//nếu ko thành công ta chả về request để xem request }
public async Task <IActionResult> Delete(int id) { await _productApiClient.Delete(id); return(RedirectToAction("Index")); }
public async Task TearDown() { await _productApiClient.Delete(_createdProductId); }
public async Task <ApiResult <bool> > Delete(int id) { var data = await _productApiClient.Delete(id); return(data); }