public string Update(Vendor entity)
 {
     var originalEntity = this.Context.Vendors.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id.ToString();
 }
Пример #2
0
 public VendorModel(Vendor entity)
 {
     this.Address = entity.Address;
     this.ContactNo = entity.ContactNo;
     this.Name = entity.Name;
     this.EndDate = entity.EndDate;
     this.Id = entity.Id;
     this.CompanyId = entity.CompanyId;
     this.StartDate = entity.StartDate;
     this.CreateBy = entity.CreateBy;
     this.CreateDate = entity.CreateDate;
     this.UpdateBy = entity.UpdateBy;
     this.UpdateDate = entity.UpdateDate;
 }
 public string Insert(Vendor entity)
 {
     this.Context.Vendors.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }
Пример #4
0
 public string Update(Vendor entity)
 {
     return this.repository.Update(entity);
 }
Пример #5
0
 public string Insert(Vendor entity)
 {
     return this.repository.Insert(entity);
 }
Пример #6
0
 private static Vendor GetEntityByModel(VendorModel model)
 {
     if (model == null) return null;
     Vendor entity = new Vendor();
     entity.Id = model.Id;
     entity.Name = model.Name;
     entity.Address = model.Address;
     entity.ContactNo = model.ContactNo;
     entity.SOBId = SessionHelper.SOBId;
     entity.StartDate = model.StartDate;
     entity.EndDate = model.EndDate;
     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.UpdateBy = AuthenticationHelper.UserId;
     entity.UpdateDate = DateTime.Now;
     return entity;
 }