Example #1
0
        public bool registrerKunde(kunde spm)
        {
            using (var db = new FaqContext())
            {
                try
                {
                    var nyttSpm = new kunde()
                    {
                        id        = spm.id,
                        fornavn   = spm.fornavn,
                        etternavn = spm.etternavn,
                        epost     = spm.epost,
                        spm       = spm.spm
                    };

                    db.Kunder.Add(nyttSpm);
                    db.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Example #2
0
        public bool registrerspørsmål(faqhjelp spml)
        {
            using (var db = new FaqContext())
            {
                try
                {
                    var nyttSpml = new faqhjelp()
                    {
                        id     = spml.id,
                        spml   = spml.spml,
                        svar   = spml.svar,
                        like   = spml.like,
                        unlike = spml.unlike
                    };

                    db.Spm.Add(nyttSpml);
                    db.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
        public ActionResult Index()
        {
            FaqContext db      = new FaqContext();
            var        allFaqs = db.Faqs.ToList();

            ViewBag.FaqsList = allFaqs;
            return(View());
        }
Example #4
0
 public bool AddUserQuestion(UserQuestionDomainModel question)
 {
     using (var db = new FaqContext())
     {
         db.Question.Add(new UserQuestion {
             Name     = question.Name,
             Date     = DateTime.Now,
             Email    = question.Email,
             Question = question.Question,
             Answer   = "Ubesvart"
         });
         db.SaveChanges();
         log.Debug("AddUserQuestionDb");
         return(true);
     }
 }
Example #5
0
 public List <FaqDomainModel> getCategoryContent(Category category)
 {
     using (var db = new FaqContext())
     {
         List <Faq>            faq             = db.Faq.Where(o => o.Category == category).ToList();
         List <FaqDomainModel> categoryContent = new List <FaqDomainModel>();
         faq.ForEach(c => categoryContent.Add(new FaqDomainModel
         {
             Category = category.ToString(),
             Question = c.Question,
             Answer   = c.Answer
         }));
         log.Error("getCategory" + categoryContent);
         return(categoryContent);
     }
 }
Example #6
0
        public List <FaqDomainModel> getAllAnswers()
        {
            using (var db = new FaqContext())
            {
                List <Faq> faq = (from a in db.Faq
                                  select a).ToList();

                List <FaqDomainModel> allAnswers = new List <FaqDomainModel>();
                faq.ForEach(c => allAnswers.Add(new FaqDomainModel
                {
                    Question = c.Question,
                    Answer   = c.Answer
                }));
                log.Error("getAllAnswers" + allAnswers);
                return(allAnswers);
            }
        }
Example #7
0
        public List <UserQuestionDomainModel> getAllUserQuestions()
        {
            using (var db = new FaqContext())
            {
                List <UserQuestion> queryResult = (from a in db.Question
                                                   select a).ToList();

                List <UserQuestionDomainModel> allAnswers = new List <UserQuestionDomainModel>();

                queryResult.ForEach(c => allAnswers.Add(new UserQuestionDomainModel
                {
                    Id       = c.Id,
                    Name     = c.Name,
                    Email    = c.Email,
                    Date     = c.Date.ToShortDateString(),
                    Question = c.Question,
                    Answer   = c.Answer
                }));
                log.Error("Failed to get Airports");
                return(allAnswers);
            }
        }
Example #8
0
        public List <kunde> alleSpm()
        {
            var db    = new FaqContext();
            var liste = new List <kunde>();

            var allespm = db.Kunder.ToList();

            foreach (var spm in allespm)
            {
                kunde k = new kunde
                {
                    id        = spm.id,
                    fornavn   = spm.fornavn,
                    etternavn = spm.etternavn,
                    epost     = spm.epost,
                    spm       = spm.spm
                };
                liste.Add(k);
            }
            ;

            return(liste);
        }
Example #9
0
        public List <faqhjelp> AlleSpmOgSvar()
        {
            var db    = new FaqContext();
            var liste = new List <faqhjelp>();

            var AlleSpmSvarListe = db.Spm.ToList();

            foreach (var spmsvar in AlleSpmSvarListe)
            {
                faqhjelp k = new faqhjelp
                {
                    id     = spmsvar.id,
                    spml   = spmsvar.spml,
                    svar   = spmsvar.svar,
                    like   = spmsvar.like,
                    unlike = spmsvar.unlike
                };
                liste.Add(k);
            }
            ;

            return(liste);
        }
Example #10
0
 public AnswersController(FaqContext context) : base(context)
 {
 }
Example #11
0
 /// <inheritdoc />
 /// <summary>
 /// The default constructor
 /// </summary>
 /// <param name="service">The injected context service</param>
 public HomeController(FaqContext service) : base(service)
 {
 }
 /// <inheritdoc />
 /// <summary>
 /// The default constructor
 /// </summary>
 /// <param name="service">The injected context service</param>
 /// <param name="fileFactory">The injected file factory</param>
 public AnswersController(FaqContext service) : base(service)
 {
 }
Example #13
0
 public UsersController(FaqContext context) : base(context)
 {
 }
Example #14
0
 public DataInitializer(FaqContext context)
 {
     _context = context;
 }
Example #15
0
 public CategoriesController(FaqContext context)
 {
     _context = context;
 }
Example #16
0
 public TagsController(FaqContext context) : base(context)
 {
 }
Example #17
0
 public HomeController(FaqContext ctx)
 {
     context = ctx;
 }
Example #18
0
 public FaqController(FaqContext context)
 {
     _context = context;
 }
 public FaqController(FaqContext context)
 {
     this.db = context;
 }
Example #20
0
 public QuestionsController(FaqContext context) : base(context)
 {
 }