private RFQDetail getEntityByModel(RFQDetailModel model)
        {
            if (model == null) return null;
            RFQDetail entity = new RFQDetail();

            entity.Id = model.Id;
            entity.ItemId = model.ItemId;
            entity.Quantity = model.Quantity;
            entity.RFQId = model.RFQId;
            entity.TargetPrice = model.TargetPrice;
            
            if (model.Id == 0)
            {
                entity.CreateBy = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CreateBy = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }

            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;
            return entity;
        }
 public string UpdateRFQDetail(RFQDetail entity)
 {
     var originalEntity = this.Context.RFQDetails.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 InsertRFQDetail(RFQDetail entity)
 {
     this.Context.RFQDetails.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }
 public string UpdateRFQDetail(RFQDetail entity)
 {
     return this.repository.UpdateRFQDetail(entity);
 }
 public string InsertRFQDetail(RFQDetail entity)
 {
     return this.repository.InsertRFQDetail(entity);
 }
 public RFQDetailModel(RFQDetail entity)
 {
     if (entity != null)
     {
         this.CreateBy = entity.CreateBy;
         this.CreateDate = entity.CreateDate;
         this.Id = entity.Id;
         this.ItemId = entity.ItemId;
         this.Quantity = entity.Quantity;
         this.RFQId = entity.RFQId;
         this.TargetPrice = entity.TargetPrice;
         this.UpdateBy = entity.UpdateBy;
         this.UpdateDate = entity.UpdateDate;
     }
 }