public OptionalFieldStyle GetStyle(int?optionalFieldStyleId) { OptionalFieldStyle optionalFieldStyle = new OptionalFieldStyle(); optionalFieldStyle = db.OptionalFieldStyles.SingleOrDefault(c => c.OptionalFieldStyleId == optionalFieldStyleId); return(optionalFieldStyle); }
// GET: Create A Single OptionalField public ActionResult Create() { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } OptionalFieldVM optionalFieldVM = new OptionalFieldVM(); OptionalField optionalField = new OptionalField(); OptionalFieldStyle optionalFieldStyle = new OptionalFieldStyle(); optionalField.OptionalFieldStyle = optionalFieldStyle; optionalFieldVM.OptionalField = optionalField; OptionalFieldStyleRepository optionalFieldStyleRepository = new OptionalFieldStyleRepository(); optionalFieldVM.OptionalFieldStyles = optionalFieldStyleRepository.GetAllOptionalFieldStyles().ToList(); return(View(optionalFieldVM)); }