Esempio n. 1
0
        public void Add(WebRequestModel entity)
        {
            if (!string.IsNullOrEmpty(entity._id.ToString()))
            {
                return;
            }

            EntityCollection.InsertOneAsync(WebRequestModel.WebRequestModelToBsonDocument(entity));
        }
Esempio n. 2
0
        public void Update(string objectId, WebRequestModel employee)
        {
            var updateBuilder = Builders<BsonDocument>.Update
                .Set("RequestedOn", employee.RequestedOn.ToString(CultureInfo.InvariantCulture))
                .Set("SiteName", employee.SiteName)
                .Set("UserAgent", employee.UserAgent)
                .Set("Referrer", employee.Referrer)
                .Set("Url", employee.Url)
                .Set("Port", employee.Port)
                .Set("Authority", employee.Authority);

            EntityCollection.UpdateOneAsync(Builders<BsonDocument>.Filter.Eq("_id", objectId), updateBuilder);
        }
Esempio n. 3
0
        public static BsonDocument WebRequestModelToBsonDocument(WebRequestModel model)
        {
            var document = new BsonDocument()
            {
                {"RequestedOn", model.RequestedOn.ToString()},
                {"SiteName", model.SiteName},
                {"UserAgent", model.UserAgent},
                {"Referrer", model.Referrer},
                {"Url", model.Url},
                {"Port", model.Port},
                {"Authority", model.Authority}
            };

            return document;
        }