Example #1
0
        public bool DeleteInvoice(Invoice invoice)
        {
            _rInvoice.Remove(invoice);
             var result = _uow.SaveChanges();

            if (result > 0)
                return true;
            else
                return false;
        }
Example #2
0
        public bool SaveInvoice(Invoice invoice)
        {
            try
            {
                if (invoice.Id == 0)
                {
                    _rInvoice.Add(invoice);
                }
                else
                {
                    _uow.Entry(invoice).State = EntityState.Modified;
                }
              var result = _uow.SaveChanges();

                if (result > 0)
                    return true;
                else
                    return false;
            }
            catch (Exception)
            {
                return false;
            }
        }
Example #3
0
 public void Update(Invoice obj)
 {
     Remove(obj);
     Add(obj);
 }
Example #4
0
 public void Remove(Invoice obj)
 {
     _repositoryInvoice.Remove(_repositoryInvoice.FirstOrDefault(f => f.Id == obj.Id));
 }
Example #5
0
 public void Add(Invoice obj)
 {
     _repositoryInvoice.Add(obj);
 }
Example #6
0
 public void Update(Invoice obj)
 {
     _repository.Update(obj);
 }
Example #7
0
 public void Remove(Invoice obj)
 {
     _repository.Remove(obj);
 }
Example #8
0
 public Rule GetRule(Invoice invoice)
 {
     var list = _rules.Values.ToList();
     return list.FirstOrDefault(c => c.Apply(invoice));
 }