private static InvoiceDetail getEntityByModel(InvoiceDetailModel model) { if (model == null) return null; InvoiceDetail entity = new InvoiceDetail(); if (model.Id == 0) { entity.CreateBy = AuthenticationHelper.UserId; entity.CreateDate = DateTime.Now; } else { entity.CreateBy = model.CreateBy; entity.CreateDate = model.CreateDate; } entity.Amount = model.Amount; entity.Id = model.Id; entity.InvoiceId = model.InvoiceId; entity.InvoiceSourceId = model.InvoiceSourceId; entity.ItemId = model.ItemId; entity.Quantity = model.Quantity; entity.Rate = model.Rate; entity.TaxAmount = model.TaxAmount; entity.TaxId = model.TaxId; entity.UpdateBy = AuthenticationHelper.UserId; entity.UpdateDate = DateTime.Now; return entity; }
public string Update(InvoiceDetail entity) { var originalEntity = this.Context.InvoiceDetails.Find(entity.Id); this.Context.Entry(originalEntity).CurrentValues.SetValues(entity); this.Context.Entry(originalEntity).State = EntityState.Modified; this.Commit(); return entity.Id.ToString(); }
public InvoiceDetailModel(InvoiceDetail entity) { this.Id = entity.Id; this.InvoiceId = entity.InvoiceId; this.InvoiceSourceId = entity.InvoiceSourceId; this.ItemId = entity.ItemId; this.Quantity = entity.Quantity; this.Rate = entity.Rate; this.TaxId = entity.TaxId; this.Amount = entity.Amount; this.TaxAmount = entity.TaxAmount; }
public string Insert(InvoiceDetail entity) { this.Context.InvoiceDetails.Add(entity); this.Commit(); return entity.Id.ToString(); }
public string Update(InvoiceDetail entity) { return this.repository.Update(entity); }
public string Insert(InvoiceDetail entity) { return this.repository.Insert(entity); }