public void DeletePaymentType() { Assert.IsNotNull(repo.GetUniq <PaymentMethod>(p => p.Price == 400M)); PaymentType toDelete = repo.GetUniq(p => p.Title == "CASH"); repo.Delete(toDelete); repo.Save(); Assert.IsNull(repo.GetUniq <PaymentMethod>(p => p.Price == 400M)); }
public ActionResult Delete(string id) { try { var objectId = ObjectId.Parse(id); repository.Delete(objectId); return(RedirectToAction("Index")); } catch { return(View()); } }
public IActionResult Delete([FromRoute] string id) { try { var type = _repository.GetByUserID(UserID, id); if (type == null) { return(BadRequest("Invalid payment type")); } if (_paymentRepository.ListPayment(UserID, type.Id).Any()) { return(BadRequest("Can't delete because there are payments created")); } _repository.Delete(id); return(NoContent()); } catch (Exception) { throw; } }
public void Delete(PaymentType payment_type) { _repository.Delete(payment_type); }