Ejemplo n.º 1
0
 public VendorSiteModel(VendorSite entity)
 {
     if (entity != null)
     {
         this.VendorId = entity.VendorId;
         this.CodeCombinationId = entity.CodeCombinationId;
         this.Address = entity.Address;
         this.Contact = entity.Contact;
         this.Name = entity.Name;
         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 long Insert(VendorSite entity)
 {
     this.Context.VendorSites.Add(entity);
     this.Commit();
     return entity.Id;
 }
 public long Update(VendorSite entity)
 {
     var originalEntity = this.Context.VendorSites.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id;
 }
Ejemplo n.º 4
0
 public long Update(VendorSite entity)
 {
     return this.repository.Update(entity);
 }
Ejemplo n.º 5
0
 public long Insert(VendorSite entity)
 {
     return this.repository.Insert(entity);
 }
Ejemplo n.º 6
0
 private static VendorSite GetEntityByModel(VendorSiteModel model)
 {
     if (model == null) return null;
     VendorSite entity = new VendorSite();
     entity.Id = model.Id;
     entity.Name = model.Name;
     entity.Address = model.Address;
     entity.CodeCombinationId = model.CodeCombinationId;
     entity.Contact = model.Contact;
     if (model.Id == 0)
     {
         entity.CreateBy = AuthenticationHelper.UserId;
         entity.CreateDate = DateTime.Now;
     }
     else
     {
         entity.CreateBy = model.CreateBy;
         entity.CreateDate = model.CreateDate;
     }
     entity.EndDate = model.EndDate;
     entity.StartDate = model.StartDate;
     entity.UpdateBy = AuthenticationHelper.UserId;
     entity.UpdateDate = DateTime.Now;
     entity.VendorId = model.VendorId;
     return entity;
 }