public ActionResult Create(MetaFormViewModel model) { var availableMetaTypes = _metaRepository.GetMetaTypeProperties(); if (ModelState.IsValid) { if (_metaRepository.CheckMetaTypeNameAvailability(model.MetaTypeName, model.Id)) { var availableMetaType = availableMetaTypes.FirstOrDefault(m => m.FullPropertyName == model.SelectedMetaTypeValue); if (availableMetaType != null) { var metaType = new CCM.Core.Entities.MetaType() { FullPropertyName = availableMetaType.FullPropertyName, Name = model.MetaTypeName, PropertyName = availableMetaType.PropertyName, Type = availableMetaType.Type, CreatedBy = User.Identity.Name, UpdatedBy = User.Identity.Name }; _metaRepository.Save(metaType); return(RedirectToAction("Index")); } } } model.MetaTypeValues = availableMetaTypes; return(View(model)); }
public ActionResult Create() { var model = new MetaFormViewModel { MetaTypeValues = _metaRepository.GetMetaTypeProperties() }; return(View(model)); }
public ActionResult Edit(Guid id) { var metaType = _metaRepository.GetById(id); if (metaType == null) { return(RedirectToAction("Index")); } var model = new MetaFormViewModel { MetaTypeValues = _metaRepository.GetMetaTypeProperties(), MetaTypeName = metaType.Name, Id = metaType.Id, SelectedMetaTypeValue = metaType.FullPropertyName }; return(View(model)); }