Пример #1
0
 /// <summary> - NewBusiness: add business to business tbl in db.
 public static Business__tbl NewBusiness(Business__tbl budal)
 {
     try
     {
         using (projectDBEntities5 db = new projectDBEntities5())
         {
             Business__tbl newBusiness = new Business__tbl
             {
                 BusinessCode        = budal.BusinessCode,
                 CategoryCode        = budal.CategoryCode,
                 BusinessOwnerCode   = budal.BusinessOwnerCode,
                 BusinessName        = budal.BusinessName,
                 FullAddress         = budal.FullAddress,
                 Phone               = budal.Phone,
                 BusinessDescription = budal.BusinessDescription,
             };
             db.Business__tbl.Add(newBusiness);
             //db.Entry(newUser).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(newBusiness);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(null);
     }
 }
Пример #2
0
 public BusinessDTO(DAL.Business__tbl business)
 {
     this.BusinessCode        = business.BusinessCode;
     this.BusinessName        = business.BusinessName;
     this.CategoryCode        = business.CategoryCode;
     this.BusinessOwnerCode   = business.BusinessOwnerCode;
     this.FullAddress         = business.FullAddress;
     this.Phone               = business.Phone;
     this.BusinessDescription = business.BusinessDescription;
 }