Beispiel #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);
                }
            }
        }
Beispiel #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());
        }
Beispiel #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);
     }
 }
Beispiel #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);
     }
 }
Beispiel #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);
            }
        }
Beispiel #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);
            }
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #10
0
 public AnswersController(FaqContext context) : base(context)
 {
 }
Beispiel #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)
 {
 }
Beispiel #13
0
 public UsersController(FaqContext context) : base(context)
 {
 }
Beispiel #14
0
 public DataInitializer(FaqContext context)
 {
     _context = context;
 }
Beispiel #15
0
 public CategoriesController(FaqContext context)
 {
     _context = context;
 }
Beispiel #16
0
 public TagsController(FaqContext context) : base(context)
 {
 }
Beispiel #17
0
 public HomeController(FaqContext ctx)
 {
     context = ctx;
 }
Beispiel #18
0
 public FaqController(FaqContext context)
 {
     _context = context;
 }
 public FaqController(FaqContext context)
 {
     this.db = context;
 }
Beispiel #20
0
 public QuestionsController(FaqContext context) : base(context)
 {
 }