private static AccountValue getEntityByModel(AccountValueViewModel model)
        {
            if (model == null) return null;
            AccountValue entity = new AccountValue();

            entity.AccountType = model.AccountType;
            entity.ChartId = model.ChartId;
            entity.EndDate = model.EndDate;
            entity.Id = model.Id;
            entity.Levl = model.Levl;
            entity.Segment = model.Segment;
            entity.StartDate = model.StartDate;
            if (model.Id == 0)
            {
                entity.CreateDate = DateTime.Now;
                entity.CreateBy = AuthenticationHelper.UserId;
                entity.CompanyId = AuthenticationHelper.CompanyId.Value;
            }
            else
            {
                entity.CreateBy = model.CreateBy;
                entity.CreateDate = model.CreateDate;
                entity.CompanyId = model.CompanyId;
            }
            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;
            entity.Value = model.Value;
            entity.ValueName = model.ValueName;

            return entity;
        }
 public AccountValueViewModel(AccountValue entity)
 {
     this.AccountType = entity.AccountType;
     this.ChartId = entity.ChartId;
     this.EndDate = entity.EndDate;
     this.Id = entity.Id;
     this.Levl = entity.Levl;
     this.Segment = entity.Segment;
     this.StartDate = entity.StartDate;
     this.Value = entity.Value;
     this.ValueName = entity.ValueName;
 }
 public string Update(AccountValue entity)
 {
     return this.repository.Update(entity);
 }
 public string Insert(AccountValue entity)
 {
     return this.repository.Insert(entity);
 }
 public string Insert(AccountValue entity)
 {
     this.Context.AccountValues.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }
 public string Update(AccountValue entity)
 {
     AccountValue originalEntity = this.Context.AccountValues.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id.ToString();
 }