private static PayableInvoiceDetail getEntityByModel(PayableInvoiceDetailModel model, int count)
        {
            if (model == null)
                return null;

            PayableInvoiceDetail entity = new PayableInvoiceDetail();
            if (count == 0)
            {
                entity.CreateBy = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CreateBy = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }

            entity.Amount = model.Amount;
            entity.CodeCombinationId = model.CodeCombinationId;
            entity.Description = model.Description;
            entity.Id = model.Id;
            entity.InvoiceId = model.InvoiceId;
            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;

            return entity;
        }
 public string Update(PayableInvoiceDetail entity)
 {
     var originalEntity = this.Context.PayableInvoiceDetails.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id.ToString();
 }
 public PayableInvoiceDetailModel(PayableInvoiceDetail entity)
 {
     this.Amount = entity.Amount;
     this.CodeCombinationId = entity.CodeCombinationId;
     this.CreateBy = entity.CreateBy;
     this.CreateDate = entity.CreateDate;
     this.Description = entity.Description;
     this.Id = entity.Id;
     this.InvoiceId = entity.InvoiceId;
     this.UpdateBy = entity.UpdateBy;
     this.UpdateDate = entity.UpdateDate;
 }
 public string Insert(PayableInvoiceDetail entity)
 {
     this.Context.PayableInvoiceDetails.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }
 public string Update(PayableInvoiceDetail entity)
 {
     return this.repository.Update(entity);
 }
 public string Insert(PayableInvoiceDetail entity)
 {
     return this.repository.Insert(entity);
 }