LabExercises.cs 1017 Bytes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using AIAHTML5.API.Properties;
using MongoDB.Driver.Builders;

namespace AIAHTML5.API.Models
{
    public class LabExercises
    {
        public int Attemptnumber { get; set; }
        public string labExerciseCode { get; set; }
        public string Answer { get; set; }
        public int Question { get; set; }
        public int Score { get; set; }


        public void UpdateUserLabExercise(Users objUser)
        {
            var client = new MongoClient();
            var db = client.GetDatabase(Settings.Default.database);

            var collection = db.GetCollection<BsonDocument>("Users");

            collection.UpdateOne(
            Builders<BsonDocument>.Filter.Eq("loginId", objUser.loginId),
            Builders<BsonDocument>.Update.Set("LabExerciseAttempt", objUser.labExerciseAttempt));
           

        }
    }
}