public IActionResult Get()
        {
            //if ((new[] { "Admin", "User", "Anonymous" }).Contains(ValidateTokenAndRole.ValidateAndGetRole(Request), StringComparer.OrdinalIgnoreCase))
            // {
            IEnumerable <ClasseModel> List = repo.GetAll().Select(Classe => Classe?.MapTo <ClasseModel>());

            if (List.Count() == 0)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(JsonConvert.SerializeObject(List)));
            }
            // }
            // else return Unauthorized();
        }
 /// <summary>
 /// Get API/Classe
 /// </summary>
 /// <returns>List de toutes les Classes</returns>
 public IHttpActionResult Get()
 {
     if ((new[] { "Admin", "User", "Anonyme" }).Contains(ValidateTokenAndRole.ValidateAndGetRole(Request), StringComparer.OrdinalIgnoreCase))
     {
         IEnumerable <ClasseModel> List = repo.GetAll().Select(Classe => Classe?.MapTo <ClasseModel>());
         if (List.Count() == 0)
         {
             return(NotFound());
         }
         else
         {
             return(Json(List));
         }
     }
     else
     {
         return(Unauthorized());
     }
 }
Beispiel #3
0
 public IEnumerable <B_Classe> Get()
 {
     return(classeR.GetAll().Select(m => Mapper <Classe, B_Classe> .Map(m)));
 }