private static CustomerSite getEntityByModel(CustomerSiteModel model)
        {
            if (model == null) return null;

            CustomerSite entity = new CustomerSite();

            if (model.Id == 0)
            {
                entity.CreateBy = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CreateBy = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }
            entity.CodeCombinationId = model.CodeCombinationId;
            entity.CustomerId = model.CustomerId;
            entity.EndDate = model.EndDate;
            entity.Id = model.Id;
            entity.SiteAddress = model.SiteAddress;
            entity.SiteContact = model.SiteContact;
            entity.SiteName = model.SiteName;
            entity.StartDate = model.StartDate;
            entity.TaxCodeId = model.TaxId;
            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;
            return entity;
        }
 public string Update(CustomerSite entity)
 {
     CustomerSite originalEntity = this.Context.CustomerSites.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id.ToString();
 }
 public CustomerSiteModel(CustomerSite entity)
 {
     if (entity != null)
     {
         this.CustomerId = entity.CustomerId;
         this.CodeCombinationId = entity.CodeCombinationId;
         this.SiteAddress = entity.SiteAddress;
         this.SiteContact = entity.SiteContact;
         this.SiteName = entity.SiteName;
         this.TaxId = entity.TaxCodeId;
         this.EndDate = entity.EndDate;
         this.Id = entity.Id;
         this.StartDate = entity.StartDate;
         this.CreateBy = entity.CreateBy;
         this.CreateDate = entity.CreateDate;
         this.UpdateBy = entity.UpdateBy;
         this.UpdateDate = entity.UpdateDate;
     }
 }
 public string Update(CustomerSite entity)
 {
     return this.repository.Update(entity);
 }
 public string Insert(CustomerSite entity)
 {
     return this.repository.Insert(entity);
 }
 public string Insert(CustomerSite entity)
 {
     this.Context.CustomerSites.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }