Example #1
0
        ////Corrected //////////////////


        /// <summary>
        /// Business Logic converted to Entities class
        ///
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public static Entities.Answers MapAnswer(BusinessLogic.Answer a)
        {
            //declare the new instance of the EF class
            DataAccess.Entities.Answers x = new DataAccess.Entities.Answers();

            /*
             *
             *
             *
             *
             *  public int QuestionID { get; set; }
             *  public Questions Question { get; set; }
             *  public int UpVote { get; set; }
             *  public int DownVote { get; set; }
             *  public int UserID { get; set; }
             * */
            //map


            x.QuestionID = a.AnsQuestionID;             //what question does this answer pertain to?

            x.Best = a.Best;                            //is this the best answer?

            x.DownVote = a.DownVote;                    //upvote and downvote values.
                                                        //       ^
            x.UpVote = a.UpVote;                        //       |

            x.Sources = a.Source;                       // Citation for source-material on answer

            x.UserID = a.Author.Id;                     //who wrote the answer?
            x.Answer = a.AnswerText;
            x.Id     = a.ID;
            return(x);
        }
Example #2
0
        /// <summary>
        /// Entities converted to Business Logic  class
        ///  with included answers and user
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public static BusinessLogic.Answer MapAnswer(DataAccess.Entities.Answers a)
        {
            var x = new BusinessLogic.Answer()
            {
                AnswerText = a.Answer,          //the body text of the answer

                Author = MapUser(a.User),       //the user who wrote it.

                Best = a.Best,                  //is this the best answer?

                DownVote = a.DownVote,          //upvote value

                UpVote = a.UpVote,              //downvote value

                Source = a.Sources              //citations, the source of information to support the answer.
            };

            return(x);
        }