/// <summary> /// Get API/BossZone /// </summary> /// <returns>List de toutes les BossZone</returns> public IHttpActionResult Get() { if ((new[] { "Admin", "User", "Anonyme" }).Contains(ValidateTokenAndRole.ValidateAndGetRole(Request), StringComparer.OrdinalIgnoreCase)) { IEnumerable <BossesZoneModel> List = repo.GetAll().Select(BossZone => BossZone?.ToModel()); if (List.Count() == 0) { return(NotFound()); } else { return(Json(List)); } } else { return(Unauthorized()); } }
public IActionResult Get() { if ((new[] { "Admin", "User", "Anonymous" }).Contains(ValidateTokenAndRole.ValidateAndGetRole(Request), StringComparer.OrdinalIgnoreCase)) { IEnumerable <BossesZoneModel> List = repo.GetAll().Select(BossZone => BossZone?.ToModel()); return(Ok(JsonConvert.SerializeObject(List))); } else { return(Unauthorized()); } }