public string Update(PayablePeriod entity) { if (entity.IsValid()) return this.repository.Update(entity); else return "Entity is not in valid state"; }
private static PayablePeriod getEntityByModel(PayablePeriodModel model) { if (model == null) return null; PayablePeriod entity = new PayablePeriod(); 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.CalendarId = model.CalendarId; entity.Id = model.Id; entity.SOBId = model.SOBId; entity.Status = model.Status; entity.UpdateBy = AuthenticationHelper.UserId; entity.UpdateDate = DateTime.Now; return entity; }
public string Update(PayablePeriod entity) { var originalEntity = this.Context.PayablePeriods.Find(entity.Id); this.Context.Entry(originalEntity).CurrentValues.SetValues(entity); this.Context.Entry(originalEntity).State = EntityState.Modified; this.Commit(); return entity.Id.ToString(); }
public PayablePeriodModel(PayablePeriod entity) { this.Id = entity.Id; this.SOBId = entity.SOBId; this.Status = entity.Status; this.CalendarId = entity.CalendarId; this.CompanyId = entity.CompanyId; this.CreateBy = entity.CreateBy; this.CreateDate = entity.CreateDate; this.UpdateBy = entity.UpdateBy; this.UpdateDate = entity.UpdateDate; }
public string Insert(PayablePeriod entity) { this.Context.PayablePeriods.Add(entity); this.Commit(); return entity.Id.ToString(); }