public ActionResult Create(TagDetailIdentifierCollection collection) { try { // TODO: Add insert logic here if (ModelState.IsValid) { collection.DocumentType = "TagDetailIdentifier"; _tagDetailIdentifierContext.Create(collection); } return(RedirectToAction("Index")); } catch { return(View()); } }
public bool Create(TagDetailIdentifierCollection tagDetail) { var returnRes = false; try { var tagDetailDocument = tagDetail.ToBsonDocument(); var tagDetailCollection = _database.GetCollection <BsonDocument>("TagDetailIdentifierCollection"); tagDetailCollection.InsertOne(tagDetailDocument); returnRes = true; } catch (Exception e) { Console.WriteLine(e); } return(returnRes); }