예제 #1
0
        public ActionResult CreateProperty(PropertyCreateModel model)
        {
            if (ModelState.IsValid)
            {
                using (var db = new ApplicationDbContext())
                {
                    var property = new Property
                    {
                        Address = model.Address
                    };

                    db.Properties.Add(property);
                    db.SaveChanges();
                }

                return(RedirectToAction(nameof(ListProperties)));
            }

            return(View(nameof(CreateProperty), model));
        }
예제 #2
0
        public ActionResult CreateProperty()
        {
            var model = new PropertyCreateModel();

            return(View(nameof(CreateProperty), model));
        }