public void insertRecordsTest()
 {
     for (int i = 1; i <= 10; i++)
     {
         var vo = new PropertyTypeVo();
         //vo.propertyTypeId = i;
         vo.name = i.ToString() + " Test PropertyType Name ";
         var result = propertyTypeManager.insert(vo);
         if (result == null)
         {
             Assert.IsTrue(false);
             break;
         }
     }
     Assert.IsTrue(true);
 }
        public void insertDeleteTest()
        {
            var vo = new PropertyTypeVo();
            vo.name = "testName";
            vo.description = "testDescription";
            // do we need other columns?
            var result = propertyTypeManager.insert(vo);
            var result2 = propertyTypeManager.get(result.propertyTypeId);

            propertyTypeManager.delete(result.propertyTypeId);

            var result3 = propertyTypeManager.get(result.propertyTypeId);

            if (result != null && result2 != null && result3 == null && result2.propertyTypeId != 0)
            {
                Assert.IsTrue(true);
            }
            else
                Assert.IsTrue(false);
        }
        public PropertyTypeVo insert(PropertyTypeVo input)
        {
            using (var db = new MainDb())
            {

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

                return input;
            }
        }
        public PropertyTypeVo update(PropertyTypeVo input, int? propertyTypeId= null)
        {
            using (var db = new MainDb())
            {

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

                var res = db.propertyTypes.FirstOrDefault(e => e.propertyTypeId == propertyTypeId);

                if (res == null) return null;

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

                db.SaveChanges();
                return res;

            }
        }