public void insertRecordsTest()
 {
     for (int i = 1; i <= 10; i++)
     {
         var vo = new BusinessVo();
         vo.name = i.ToString()+" Test Business Name ";
         //vo.siteId = 1;
         var result = businessManager.insert(vo);
         if (result == null)
         {
             Assert.IsTrue(false);
             break;
         }
     }
     Assert.IsTrue(true);
 }
        public void insertDeleteTest()
        {
            var vo = new BusinessVo();
            vo.name = "testName";
            vo.address = "124 address";

            var result = businessManager.insert(vo);
            var result2 = businessManager.get(result.businessId);

            businessManager.delete(result.businessId);

            var result3 = businessManager.get(result.businessId);

            if (result != null && result2 != null && result3 == null && result2.businessId!=Guid.Empty)
            {
                Assert.IsTrue(true);
            }
            else
                Assert.IsTrue(false);
        }
        public BusinessVo insert(BusinessVo input)
        {
            using (var db = new MainDb())
            {

                db.businesses.Add(input);
                db.SaveChanges();

                return input;
            }
        }
        public BusinessVo update(BusinessVo input, Guid? businessId= null)
        {
            using (var db = new MainDb())
            {

                if (businessId == null)
                    businessId = input.businessId;

                var res = db.businesses.FirstOrDefault(e => e.businessId == businessId);

                if (res == null) return null;

                input.created = res.created;
               // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);

                db.SaveChanges();
                return res;

            }
        }