コード例 #1
0
ファイル: MongoRepo.cs プロジェクト: hknyrmg/AspCorePluSight
        public Election.Person addPerson(Election.Person person)
        {
            mongoDatabase = GetMongoDatabase();

            var result = mongoDatabase.GetCollection <Election.Person>("Election").Find(FilterDefinition <Election.Person> .Empty).ToList();

            mongoDatabase.GetCollection <Election.Person>("Election").InsertOne(person);

            return(person);
        }
コード例 #2
0
        public IActionResult Index()
        {
            Election.Person person = null;
            string          path   = @"C:\Users\hyarimaga\Desktop\New folder\new.xml";

            XmlSerializer serializer = new XmlSerializer(typeof(Election.Person));

            StreamReader reader = new StreamReader(path);

            person = (Election.Person)serializer.Deserialize(reader);
            reader.Close();

            return(View(person));
        }