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