private RequisitionDetail getEntityByModel(RequisitionDetailModel model) { if (model == null) return null; RequisitionDetail entity = new RequisitionDetail(); if (model.Id == 0) { entity.CreateBy = AuthenticationHelper.UserId; entity.CreateDate = DateTime.Now; } else { entity.CreateBy = model.CreateBy; entity.CreateDate = model.CreateDate; } entity.Id = model.Id; entity.ItemId = model.ItemId; entity.NeedByDate = model.NeedByDate; entity.Price = model.Price; entity.Quantity = model.Quantity; entity.RequisitionId = model.RequisitionId; entity.Status = model.Status; entity.VendorId = model.VendorId; entity.VendorSiteId = model.VendorSiteId; return entity; }
public string Update(RequisitionDetail entity) { var originalEntity = this.Context.RequisitionDetails.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(RequisitionDetail entity) { this.Context.RequisitionDetails.Add(entity); this.Commit(); return entity.Id.ToString(); }
public string Update(RequisitionDetail entity) { return this.repository.Update(entity); }
public string Insert(RequisitionDetail entity) { return this.repository.Insert(entity); }
public RequisitionDetailModel(RequisitionDetail entity) { if (entity != null) { this.CreateBy = entity.CreateBy; this.CreateDate = entity.CreateDate; this.Id = entity.Id; this.ItemId = entity.ItemId; this.NeedByDate = entity.NeedByDate; this.Price = entity.Price; this.Quantity = entity.Quantity; this.RequisitionId = entity.RequisitionId; this.Status = entity.Status; this.UpdateBy = entity.UpdateBy; this.UpdateDate = entity.UpdateDate; this.VendorId = entity.VendorId; this.VendorSiteId = entity.VendorSiteId; } }