public JsonResult Delete(System.Int32 id) { RemoveSupplierRequest request = new RemoveSupplierRequest(); request.SupplierID = id; RemoveSupplierResponse response = _supplierService.RemoveSupplier(request); return(Json(response)); }
public RemoveSupplierResponse RemoveSupplier(RemoveSupplierRequest request) { RemoveSupplierResponse response = new RemoveSupplierResponse(); response.Errors = new List <BusinessRule>(); try { if (_supplierRepository.Remove(request.SupplierID) > 0) { response.SupplierDeleted = true; } } catch (Exception ex) { response.Errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message)); } return(response); }
public async Task <Result <Unit, ProblemDetails> > RemoveSupplier(string htAccommodationId, RemoveSupplierRequest request, CancellationToken cancellationToken = default) { using var requestContent = new StringContent(JsonSerializer.Serialize(request), Encoding.UTF8, "application/json"); var requestUri = $"api/1.0/admin/accommodations/{htAccommodationId}/suppliers/remove"; return(await Post(requestUri, requestContent, cancellationToken : cancellationToken)); }
public async Task <IActionResult> RemoveSupplierAccommodation([FromRoute] string htAccommodationId, RemoveSupplierRequest request, CancellationToken cancellationToken = default) { var(_, isFailure, error) = await _supplierManagementService.RemoveSupplierAccommodation(htAccommodationId, request.Supplier, request.SupplierAccommodationId, cancellationToken); if (isFailure) { return(BadRequestWithProblemDetails(error)); } return(NoContent()); }