Esempio n. 1
0
        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));
        }
Esempio n. 2
0
 public ActionResult Delete(string id)
 {
     try
     {
         var objectId = ObjectId.Parse(id);
         repository.Delete(objectId);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
 public void Delete(PaymentType payment_type)
 {
     _repository.Delete(payment_type);
 }