public async Task <SubscriptionPlanResponse> DeleteAsync(int id) { var existingSubscriptionPlan = await _subscriptionPlanRepository.FindById(id); if (existingSubscriptionPlan == null) { return(new SubscriptionPlanResponse("subscription plan not found")); } try { _subscriptionPlanRepository.Remove(existingSubscriptionPlan); await _unitOfWork.CompleteAsync(); return(new SubscriptionPlanResponse(existingSubscriptionPlan)); } catch (Exception ex) { return(new SubscriptionPlanResponse($"An error ocurred while deleting subscription plan: {ex.Message}")); } }
public async Task <IActionResult> Delete(int id) { await _repository.Remove(id); return(NoContent()); }