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