public string Update(InvoiceType entity)
 {
     if (entity.IsValid())
         return this.repository.Update(entity);
     else
         return "Entity is not in valid state";
 }
        private static InvoiceType getEntityByModel(InvoiceTypeModel model)
        {
            if (model == null) return null;

            InvoiceType entity = new InvoiceType();
            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.Meaning = model.Meaning;
            entity.SOBId = model.SOBId;
            entity.Invoicetype = model.InvoiceType;
            entity.Id = model.Id;
            entity.Description = model.Description;
            entity.DateTo = model.DateTo;
            entity.DateFrom = model.DateFrom;
            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;
            return entity;
        }
 public string Update(InvoiceType entity)
 {
     var originalEntity = this.Context.InvoiceTypes.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id.ToString();
 }
 public InvoiceTypeModel(InvoiceType entity)
 {
     this.Id = entity.Id;
     this.SOBId = entity.SOBId;
     this.DateFrom = entity.DateFrom;
     this.DateTo = entity.DateTo;
     this.Description = entity.Description;
     this.InvoiceType = entity.Invoicetype;
     this.Meaning = entity.Meaning;
     this.CreateBy = entity.CreateBy;
     this.CreateDate = entity.CreateDate;
     this.UpdateBy = entity.UpdateBy;
     this.UpdateDate = entity.UpdateDate;
 }
 public string Insert(InvoiceType entity)
 {
     this.Context.InvoiceTypes.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }