public ActionResult Create(NewsCategoryModel model) { var categories = mongo.GetDatabase("ddd").GetCollection<NewsCategoryModel>("newscategories"); try { categories.Insert(model); return RedirectToAction("Index"); } catch { throw; } }
public ActionResult Edit(string id, NewsCategoryModel model) { var categories = mongo.GetDatabase("ddd").GetCollection<NewsCategoryModel>("newscategories"); try { var category = categories.FindOneById(new ObjectId(id)); TryUpdateModel(category); categories.Save(category); return RedirectToAction("Index"); } catch { throw; } }