示例#1
0
        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);
            }
        }
示例#2
0
        public PropertyListingTypeVo insert(PropertyListingTypeVo input)
        {
            using (var db = new MainDb())
            {
                db.propertyListingTypes.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
示例#3
0
        public ActionResult Edit(int id, PropertyListingTypeVo input)
        {
            if (this.ModelState.IsValid)
            {
                var res = propertyListingTypeManager.update(input, id);
                return(RedirectToAction("Index"));
            }

            return(View(input));
        }
示例#4
0
        public ActionResult Create(PropertyListingTypeVo input)
        {
            if (this.ModelState.IsValid)
            {
                var item = propertyListingTypeManager.insert(input);
                return(RedirectToAction("Index"));
            }


            return(View(input));
        }
示例#5
0
        public ActionResult Create()
        {
            var vo = new PropertyListingTypeVo();

            return(View(vo));
        }