public ListingVo update(ListingVo input, Guid? listingId= null)
        {
            using (var db = new MainDb())
            {

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

                var res = db.listings.FirstOrDefault(e => e.listingId == listingId);

                if (res == null) return null;

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

                db.SaveChanges();
                return res;

            }
        }
        public StateTypeVo update(StateTypeVo input, int? stateTypeId= null)
        {
            using (var db = new MainDb())
            {

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

                var res = db.stateTypes.FirstOrDefault(e => e.stateTypeId == stateTypeId);

                if (res == null) return null;

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

                db.SaveChanges();
                return res;

            }
        }
        public MemberRoleLookupVo update(MemberRoleLookupVo input, Guid? memberRoleLookupId= null)
        {
            using (var db = new MainDb())
            {

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

                var res = db.memberRoleLookups.FirstOrDefault(e => e.memberRoleLookupId == memberRoleLookupId);

                if (res == null) return null;

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

                db.SaveChanges();
                return res;

            }
        }
        public BusinessCategoryLookupVo update(BusinessCategoryLookupVo input, Guid? businessCategoryLookupId= null)
        {
            using (var db = new MainDb())
            {

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

                var res = db.businessCategoryLookups.FirstOrDefault(e => e.businessCategoryLookupId == businessCategoryLookupId);

                if (res == null) return null;

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

                db.SaveChanges();
                return res;

            }
        }
Esempio n. 5
0
        public ImageVo update(ImageVo input, Guid? imageId= null)
        {
            using (var db = new MainDb())
            {

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

                var res = db.images.FirstOrDefault(e => e.imageId == imageId);

                if (res == null) return null;

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

                db.SaveChanges();
                return res;

            }
        }
        public PropertyListingTypeVo update(PropertyListingTypeVo input, int? propertyListingTypeId= null)
        {
            using (var db = new MainDb())
            {

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

                var res = db.propertyListingTypes.FirstOrDefault(e => e.propertyListingTypeId == propertyListingTypeId);

                if (res == null) return null;

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

                db.SaveChanges();
                return res;

            }
        }
        public JobCategoryTypeVo update(JobCategoryTypeVo input, int? jobCategoryTypeId= null)
        {
            using (var db = new MainDb())
            {

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

                var res = db.jobCategoryTypes.FirstOrDefault(e => e.jobCategoryTypeId == jobCategoryTypeId);

                if (res == null) return null;

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

                db.SaveChanges();
                return res;

            }
        }
Esempio n. 8
0
        public CarVo update(CarVo input, Guid? carId= null)
        {
            using (var db = new MainDb())
            {

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

                var res = db.cars.FirstOrDefault(e => e.carId == carId);

                if (res == null) return null;

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

                db.SaveChanges();
                return res;

            }
        }