Beispiel #1
0
 public void UpdateQuestionsCategory(QuestionsCategory category)
 {
     using (var _context = new AskUsDbContext())
     {
         _context.Entry(category).State = System.Data.Entity.EntityState.Modified;
         _context.SaveChanges();
     }
 }
Beispiel #2
0
 public void UpdateAnswerReview(AnswerReview answerReview)
 {
     using (var _context = new AskUsDbContext())
     {
         _context.Entry(answerReview).State = EntityState.Modified;
         _context.SaveChanges();
     }
 }
Beispiel #3
0
 public void UpdateUserRole(UserRole userRole)
 {
     using (var _context = new AskUsDbContext())
     {
         _context.Entry(userRole).State = System.Data.Entity.EntityState.Modified;
         _context.SaveChanges();
     }
 }
Beispiel #4
0
 public void UpdateServiceLocation(ServiceLocation serviceLocation)
 {
     using (var _context = new AskUsDbContext())
     {
         _context.Entry(serviceLocation).State = System.Data.Entity.EntityState.Modified;
         _context.SaveChanges();
     }
 }
Beispiel #5
0
 public void UpdateQuestion(Question question)
 {
     using (var _context = new AskUsDbContext())
     {
         _context.Entry(question).State = EntityState.Modified;
         _context.SaveChanges();
     }
 }
Beispiel #6
0
 public void UpdateQuestionAnswer(QuestionAnswer questionAnswer)
 {
     using (var _context = new AskUsDbContext())
     {
         _context.Entry(questionAnswer).State = System.Data.Entity.EntityState.Modified;
         _context.SaveChanges();
     }
 }
Beispiel #7
0
 /// <summary>
 /// Method to validate token against expiry and existence in database.
 /// </summary>
 /// <param name="tokenId"></param>
 /// <returns></returns>
 public bool ValidateToken(string tokenId)
 {
     using (var _context = new AskUsDbContext())
     {
         var token = _context.Tokens.Where(t => t.AuthToken == tokenId && t.ExpiresOn > DateTime.Now).FirstOrDefault();
         if (token != null && !(DateTime.Now > token.ExpiresOn))
         {
             token.ExpiresOn             = token.ExpiresOn.AddSeconds(3000);//(Convert.ToDouble(ConfigurationManager.AppSettings["AuthTokenExpiry"]));
             _context.Entry(token).State = System.Data.Entity.EntityState.Modified;
             _context.SaveChanges();
             return(true);
         }
         return(false);
     }
 }