コード例 #1
0
        public PropertyBase PropertyAdd(PropertyAdd newItem)
        {
            // Attempt to add the new item
            var addedItem = ds.Properties.Add(Mapper.Map <Property>(newItem));

            ds.SaveChanges();

            return((addedItem == null) ? null : Mapper.Map <PropertyBase>(addedItem));
        }
コード例 #2
0
        public ActionResult Create(PropertyAdd newItem)
        {
            // Validate the input
            if (!ModelState.IsValid)
            {
                return(View(newItem));
            }

            // Process the input
            var addedItem = m.PropertyAdd(newItem);

            if (addedItem == null)
            {
                return(View(newItem));
            }
            else
            {
                return(RedirectToAction("Details", new { id = addedItem.Id }));
            }
        }
コード例 #3
0
        public ActionResult Create(PropertyAdd newItem)
        {
            // Validate the input
            if (!ModelState.IsValid)
            {
                return View(newItem);
            }

            // Process the input
            var addedItem = m.PropertyAdd(newItem);

            if (addedItem == null)
            {
                return View(newItem);
            }
            else
            {
                return RedirectToAction("Details", new { id = addedItem.Id });
            }
        }
コード例 #4
0
        public PropertyBase PropertyAdd(PropertyAdd newItem)
        {
            // Attempt to add the new item
            var addedItem = ds.Properties.Add(Mapper.Map<Property>(newItem));

            ds.SaveChanges();

            return (addedItem == null) ? null : Mapper.Map<PropertyBase>(addedItem);
        }