示例#1
0
 public async Task <MyEvaluation> getMyEvaluation(int evalId)
 {
     return(await Task.Run(() =>
     {
         MyEvaluation newrec = new MyEvaluation();
         var myevalrec = db.Table <MyEvaluation>().FirstOrDefault(a => a.EvalId == evalId);
         return myevalrec == null ? newrec : myevalrec;
     }));
 }
示例#2
0
        public async Task saveMyEvaluation(MyEvaluation myEvalItem)
        {
            await Task.Run(() =>
            {
                var myeval = db.Table <MyEvaluation>().FirstOrDefault(a => a.EvalId == myEvalItem.EvalId);
                if (myeval == null)
                {
                    myeval = new MyEvaluation();
                    myeval.AvailableTotal   = myEvalItem.AvailableTotal;
                    myeval.Created          = myEvalItem.Created;
                    myeval.Duration         = myEvalItem.Duration;
                    myeval.EvalId           = myEvalItem.EvalId;
                    myeval.Modified         = myEvalItem.Modified;
                    myeval.NoOfQuestions    = myEvalItem.NoOfQuestions;
                    myeval.PassPercentage   = myEvalItem.PassPercentage;
                    myeval.QuestionCategory = myEvalItem.QuestionCategory;
                    myeval.Subject          = myEvalItem.Subject;
                    myeval.TotalScore       = myEvalItem.TotalScore;
                    myeval.UserEmail        = myEvalItem.UserEmail;
                    myeval.Year             = myEvalItem.Year;

                    db.Insert(myeval);
                }
                else
                {
                    myeval.AvailableTotal   = myEvalItem.AvailableTotal;
                    myeval.Duration         = myEvalItem.Duration;
                    myeval.Modified         = myEvalItem.Modified;
                    myeval.PassPercentage   = myEvalItem.PassPercentage;
                    myeval.QuestionCategory = myEvalItem.QuestionCategory;
                    myeval.Subject          = myEvalItem.Subject;
                    myeval.TotalScore       = myEvalItem.TotalScore;
                    myeval.Year             = myEvalItem.Year;
                    db.Update(myeval);
                }
            });
        }