Ejemplo n.º 1
0
        public void GetAllQuestionnaires()
        {
            var questionnaireCreator = new User()
            {
                Name = "User 1"
            };

            context.Users.Add(questionnaireCreator);
            context.SaveChanges();

            var questionnaire1 = new Questionnaire
            {
                Name          = "Test 1",
                CreatedByUser = questionnaireCreator,
                CreatedDate   = DateTime.Now.AddDays(-2)
            };

            var questionnaire2 = new Questionnaire
            {
                Name          = "Test 2",
                CreatedByUser = questionnaireCreator,
                CreatedDate   = DateTime.Now.AddDays(-5)
            };

            context.Questionnaires.Add(questionnaire1);
            context.Questionnaires.Add(questionnaire2);
            context.SaveChanges();

            var getAllEntitiesQuery = new GetAllEntitiesQuery(context);
            var questionnaires      = getAllEntitiesQuery.Execute <Questionnaire>();

            Assert.Equal(2, questionnaires.Count());
        }
Ejemplo n.º 2
0
 public IActionResult GetEntities([FromHeader(Name = "Authorization")] string Token)
 {
     return(getEsQuery
            .Execute()
            .Match(
                x => Ok(x),
                ex => StatusCode(500, ex)));
 }
Ejemplo n.º 3
0
 public IActionResult GetEntities()
 {
     return(getEsQuery
            .Execute()
            .Match(
                x => Ok(x),
                ex => StatusCode(500, ex)));
 }
Ejemplo n.º 4
0
 public IActionResult GetAll()
 => getAllQuery.Execute().Match(
     Succ: Ok,
     Fail: ex => StatusCode(500, ex));