private static OrderDetail getEntityByModel(OrderDetailModel model) { if (model == null) return null; OrderDetail entity = new OrderDetail(); if (model.Id == 0) { entity.CreateBy = AuthenticationHelper.UserId; entity.CreateDate = DateTime.Now; } else { entity.CreateBy = model.CreateBy; entity.CreateDate = model.CreateDate; } entity.Amount = model.Amount; entity.Id = model.Id; entity.ItemId = model.ItemId; entity.OrderId = model.OrderId; entity.Quantity = model.Quantity; entity.Rate = model.Rate; entity.TaxId = model.TaxId; entity.UpdateBy = AuthenticationHelper.UserId; entity.UpdateDate = DateTime.Now; entity.WarehouseId = model.WarehouseId; return entity; }
public string Update(OrderDetail entity) { var originalEntity = this.Context.OrderDetails.Find(entity.Id); this.Context.Entry(originalEntity).CurrentValues.SetValues(entity); this.Context.Entry(originalEntity).State = EntityState.Modified; this.Commit(); return entity.Id.ToString(); }
public OrderDetailModel(OrderDetail entity) { if (entity != null) { this.Amount = entity.Amount; this.CreateBy = entity.CreateBy; this.CreateDate = entity.CreateDate; this.Id = entity.Id; this.ItemId = entity.ItemId; this.OrderId = entity.OrderId; this.Quantity = entity.Quantity; this.Rate = entity.Rate; this.TaxId = entity.TaxId; this.UpdateBy = entity.UpdateBy; this.UpdateDate = entity.UpdateDate; this.WarehouseId = entity.WarehouseId; } }
public string Update(OrderDetail entity) { return this.repository.Update(entity); }
public string Insert(OrderDetail entity) { return this.repository.Insert(entity); }
public string Insert(OrderDetail entity) { this.Context.OrderDetails.Add(entity); this.Commit(); return entity.Id.ToString(); }