private static Customer getEntityByModel(CustomerModel model) { if (model == null) return null; Customer entity = new Customer(); 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.Address = model.Address; entity.ContactNo = model.ContactNo; entity.CustomerName = model.CustomerName; entity.EndDate = model.EndDate; entity.Id = model.Id; entity.SOBId = SessionHelper.SOBId; entity.StartDate = model.StartDate; entity.UpdateBy = AuthenticationHelper.UserId; entity.UpdateDate = DateTime.Now; return entity; }
public string Update(Customer entity) { Customer originalEntity = this.Context.Customers.Find(entity.Id); this.Context.Entry(originalEntity).CurrentValues.SetValues(entity); this.Context.Entry(originalEntity).State = EntityState.Modified; this.Commit(); return entity.Id.ToString(); }
public CustomerModel(Customer entity) { this.Address = entity.Address; this.ContactNo = entity.ContactNo; this.CustomerName = entity.CustomerName; this.EndDate = entity.EndDate; this.Id = entity.Id; this.StartDate = entity.StartDate; this.CompanyId = entity.CompanyId; this.CreateBy = entity.CreateBy; this.CreateDate = entity.CreateDate; this.UpdateBy = entity.UpdateBy; this.UpdateDate = entity.UpdateDate; }
public string Update(Customer entity) { return this.repository.Update(entity); }
public string Insert(Customer entity) { return this.repository.Insert(entity); }
public string Insert(Customer entity) { this.Context.Customers.Add(entity); this.Commit(); return entity.Id.ToString(); }