public ActionResult Edit(Technology model) { var technology = _context.Technology.First(t => t.Id == model.Id); technology.Name = Utils.Transliterator.Transliterate(model.Name); technology.Title = model.Title; technology.SortOrder = model.SortOrder; technology.Text = HttpUtility.HtmlDecode(model.Text); technology.SeoDescription = model.SeoDescription; technology.SeoKeywords = model.SeoKeywords; technology.Active = model.Active; _context.SaveChanges(); return RedirectToAction("Technologies", "Home", new { area = "" }); }
public ActionResult Create(FormCollection form, int? parentId) { var technology = new Technology { Name = Utils.Transliterator.Transliterate(form["Name"]) }; TryUpdateModel(technology, new[] { "Title", "SortOrder", "SeoDescription", "SeoKeywords" }); technology.CategoryLevel = 1; technology.Active = true; technology.Text = HttpUtility.HtmlDecode(form["Text"]); if (parentId.HasValue) { var parent = _context.Technology.First(c => c.Id == parentId); parent.Children.Add(technology); } else { _context.AddToTechnology(technology); } _context.SaveChanges(); return RedirectToAction("Technologies", "Home", new { area = "" }); }
/// <summary> /// Deprecated Method for adding a new object to the Technology EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTechnology(Technology technology) { base.AddObject("Technology", technology); }
/// <summary> /// Create a new Technology object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="categoryLevel">Initial value of the CategoryLevel property.</param> /// <param name="active">Initial value of the Active property.</param> public static Technology CreateTechnology(global::System.Int32 id, global::System.String name, global::System.String title, global::System.Int32 categoryLevel, global::System.Boolean active) { Technology technology = new Technology(); technology.Id = id; technology.Name = name; technology.Title = title; technology.CategoryLevel = categoryLevel; technology.Active = active; return technology; }