private static InvoiceSource getEntityByModel(InvoiceSourceViewModel model) { if (model == null) return null; InvoiceSource entity = new InvoiceSource(); entity.CodeCombinationId = model.CodeCombinationId; entity.StartDate = model.StartDate; entity.EndDate = model.EndDate; entity.Description = model.Description; entity.Id = model.Id; entity.SOBId = model.SOBId; if (model.Id == 0) { entity.CompanyId = AuthenticationHelper.CompanyId.Value; entity.CreateBy = AuthenticationHelper.UserId; entity.CreateDate = DateTime.Now; } else { entity.CompanyId = model.CompanyId; entity.CreateBy = model.CreateBy; entity.CreateDate = model.CreateDate; } entity.UpdateDate = DateTime.Now; entity.UpdateBy = AuthenticationHelper.UserId; return entity; }
public string Update(InvoiceSource entity) { var originalEntity = this.Context.InvoiceSources.Find(entity.Id); this.Context.Entry(originalEntity).CurrentValues.SetValues(entity); this.Context.Entry(originalEntity).State = EntityState.Modified; this.Commit(); return entity.Id.ToString(); }
public InvoiceSourceViewModel(InvoiceSource entity) { this.CodeCombinationId = entity.CodeCombinationId; this.StartDate = entity.StartDate; this.EndDate = entity.EndDate; this.Description = entity.Description; this.Id = entity.Id; this.SOBId = entity.SOBId; this.CompanyId = entity.CompanyId; this.CreateBy = entity.CreateBy; this.CreateDate = entity.CreateDate; this.UpdateBy = entity.UpdateBy; this.UpdateDate = entity.UpdateDate; }
public string Update(InvoiceSource entity) { return this.repository.Update(entity); }
public string Insert(InvoiceSource entity) { return this.repository.Insert(entity); }
public string Insert(InvoiceSource entity) { this.Context.InvoiceSources.Add(entity); this.Commit(); return entity.Id.ToString(); }