Ejemplo n.º 1
0
        public void WithEntities()
        {
            System.Collections.IEnumerable persons = session.CreateCriteria(typeof(Person)).List <Person>();

            Assert.AreEqual(2,
                            session.CreateCriteria(typeof(Mail))
                            .Add(XmlIn.Create("To", persons, 1))
                            .List <Mail>()
                            .Count);
        }
Ejemplo n.º 2
0
        public void WithValues()
        {
            int[] persons = new int[] { 0, 1, 2 };

            Assert.AreEqual(1,
                            session.CreateCriteria(typeof(Mail))
                            .Add(XmlIn.Create("From.Id", persons, 1))
                            .List <Mail>()
                            .Count);
        }
Ejemplo n.º 3
0
        public void TwoXmlIn()
        {
            System.Collections.IEnumerable persons = session.CreateCriteria(typeof(Person)).List <Person>();

            Assert.AreEqual(2,
                            session.CreateCriteria(typeof(Mail))
                            .Add(Restrictions.And(XmlIn.Create("From", persons, 1),
                                                  XmlIn.Create("To", persons, 1)))
                            .List <Mail>().Count);
        }
Ejemplo n.º 4
0
        public void WithEntitiesAndNoResults()
        {
            IList <Person> justBob = new List <Person>();

            justBob.Add(bob);

            Assert.AreEqual(0,
                            session.CreateCriteria(typeof(Mail))
                            .Add(XmlIn.Create("To", justBob))
                            .List <Mail>()
                            .Count);
        }
Ejemplo n.º 5
0
        public HttpResponseMessage Put(string content, HttpRequestMessage request)
        {
            if (String.IsNullOrWhiteSpace(content))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            string objextContent = request.Content.ReadAsStringAsync().Result;

            XmlIn xmlIn = new XmlIn()
            {
                Content   = content,
                Body      = objextContent,
                EntryDate = DateTime.Now
            };

            db.XmlIn.Add(xmlIn);
            db.SaveChanges();

            return(Request.CreateResponse(HttpStatusCode.OK));
        }