private Requisition getEntityByModel(RequisitionModel model)
        {
            if (model == null) return null;

            Requisition entity = new Requisition();

            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.BuyerId = model.BuyerId;
            entity.CompanyId = model.CompanyId;
            entity.Description = model.Description;
            entity.Id = model.Id;
            entity.RequisitionDate = model.RequisitionDate;
            entity.RequisitionNo = model.RequisitionNo;
            entity.SOBId = model.SOBId;

            return entity;
        }
 public RequisitionModel(Requisition entity)
 {
     if (entity != null)
     {
         this.BuyerId = entity.BuyerId;
         this.CompanyId = entity.CompanyId;
         this.CreateBy = entity.CreateBy;
         this.CreateDate = entity.CreateDate;
         this.Description = entity.Description;
         this.Id = entity.Id;
         this.RequisitionDate = entity.RequisitionDate;
         this.RequisitionNo = entity.RequisitionNo;
         this.SOBId = entity.SOBId;
         this.UpdateBy = entity.UpdateBy;
         this.UpdateDate = entity.UpdateDate;
     }
 }
 public string Update(Requisition entity)
 {
     var originalEntity = this.Context.Requisitions.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(Requisition entity)
 {
     this.Context.Requisitions.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }
 public string Update(Requisition entity)
 {
     return this.repository.Update(entity);
 }
 public string Insert(Requisition entity)
 {
     return this.repository.Insert(entity);
 }