/// <summary> /// Prepare new model for creating category view /// </summary> /// <param name="parentName">Parent Name of Category in what we want to create new</param> /// <returns>CategoryView model prepared for enter all needed data</returns> public static PropertyView CreateNewPropertyModel(long link_id) { var model = new PropertyView() { LinkId = link_id }; return model; }
public ActionResult CreateProperty(PropertyView property) { if (ModelState.IsValid) { PropertyManager.AddNewProperty(property); return RedirectToAction("Properties", new RouteValueDictionary( new { link_id = property.LinkId })); } return View(property); }
/// <summary> /// Add new property to DB /// </summary> /// <param name="property">Property which will be added</param> public static void AddNewProperty(PropertyView property) { var mapProperty = (Property)App.Mapper.Map(property, typeof(PropertyView), typeof(Property)); App.Rep.Insert<Property>(mapProperty, true); }
/// <summary> /// Edit current property /// </summary> /// <param name="property">Current property</param> public static void UpdateProperty(PropertyView property) { App.Rep.Update<Property>((Property) App.Mapper.Map(property, typeof(PropertyView), typeof(Property)), true); }