private static Order getEntityByModel(OrderModel model) { if (model == null) return null; Order entity = new Order(); 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.CustomerId = model.CustomerId; entity.CustomerSiteId = model.CustomerSiteId; entity.Id = model.Id; entity.OrderDate = model.OrderDate; entity.OrderNo = model.OrderNo; entity.OrderTypeId = model.OrderTypeId; entity.Remarks = model.Remarks; entity.SOBId = SessionHelper.SOBId; entity.Status = model.Status; entity.UpdateBy = AuthenticationHelper.UserId; entity.UpdateDate = DateTime.Now; return entity; }
public OrderModel(Order entity) { if (entity != null) { this.CompanyId = entity.CompanyId; this.CreateBy = entity.CreateBy; this.CreateDate = entity.CreateDate; this.CustomerId = entity.CustomerId; this.CustomerSiteId = entity.CustomerSiteId; this.Id = entity.Id; this.OrderDate = entity.OrderDate; this.OrderNo = entity.OrderNo; this.OrderTypeId = entity.OrderTypeId; this.Remarks = entity.Remarks; this.Status = entity.Status; this.UpdateBy = entity.UpdateBy; this.UpdateDate = entity.UpdateDate; } }
public string Update(Order entity) { return this.repository.Update(entity); }
public string Insert(Order entity) { return this.repository.Insert(entity); }
public string Update(Order entity) { var originalEntity = this.Context.Orders.Find(entity.Id); this.Context.Entry(originalEntity).CurrentValues.SetValues(entity); this.Context.Entry(originalEntity).State = EntityState.Modified; this.Commit(); return entity.Id.ToString(); }
public string Insert(Order entity) { this.Context.Orders.Add(entity); this.Commit(); return entity.Id.ToString(); }