Esempio n. 1
0
 public static StrategyModel ToModel(this StrategyEntity SE)
 {
     if (SE != null)
     {
         BossesPerZoneRepository           repoBZ = new BossesPerZoneRepository();
         CharactersConfigurationRepository repoCC = new CharactersConfigurationRepository();
         UserRepository repoU = new UserRepository();
         StrategyModel  SM    = new StrategyModel();
         SM.User = repoU.GetOne(SE.UserId).MapTo <UserModel>();
         SM.CharactersConfiguration = repoCC.GetOne(SE.CharactersConfigurationId).ToModel();
         SM.BossZone    = repoBZ.GetOne(SE.BossZoneId).ToModel();
         SM.ImagePath1  = SE.ImagePath1;
         SM.ImagePath2  = SE.ImagePath2;
         SM.ImagePath3  = SE.ImagePath3;
         SM.ImagePath4  = SE.ImagePath4;
         SM.Description = SE.Description;
         SM.Note        = SE.Note;
         SM.Id          = SE.Id;
         SM.Active      = SE.Active;
         return(SM);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Get API/BossZone/{id}
 /// </summary>
 /// <param name="id">id du BossZone à récupérer</param>
 /// <returns>BossZone avec l'id correspondant</returns>
 public IHttpActionResult Get(int id)
 {
     if ((new[] { "Admin", "User", "Anonyme" }).Contains(ValidateTokenAndRole.ValidateAndGetRole(Request), StringComparer.OrdinalIgnoreCase))
     {
         BossesZoneModel Objet = repo.GetOne(id)?.ToModel();
         if (Objet == null)
         {
             return(NotFound());
         }
         else
         {
             return(Json(Objet));
         }
     }
     else
     {
         return(Unauthorized());
     }
 }