예제 #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 }));
            }
        }
        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);
        }