Ejemplo n.º 1
0
       private CodeJewelModelFull DesirializeCodeJewelToFull(CodeJewel codeJewel)
       {
           
           double averageVote = 0;
           if (codeJewel.Votes.Count>0)
           {
              averageVote  = codeJewel.Votes.Average(v => v.VoteValue);
           }

           string category = "No Category";
           if (codeJewel.Category!= null)
           {
               category = codeJewel.Category.Name;
           }

           CodeJewelModelFull modelFull = new CodeJewelModelFull
           {
               AuthorName = codeJewel.AuthorMail,
               CodeJewel = codeJewel.SourceCode,
               Id = codeJewel.Id,
               AverageVote = averageVote,
               category = category
           };

           return modelFull;
       }
Ejemplo n.º 2
0
       private CodeJewelModel DesirializeCodeJewel(CodeJewel code)
       {
           CodeJewelModel model = new CodeJewelModel
           {
               AuthorName = code.AuthorMail,
               CodeJewel = code.SourceCode,
               Id = code.Id
           };

           return model;
       }