コード例 #1
0
        public ActionResult Create()
        {
            FAQContentModel model = new FAQContentModel();

            SetDropDownValue(model);
            return(View(model));
        }
コード例 #2
0
        public ActionResult Details(int Id)
        {
            FAQContentModel model = _provider.Details(Id);

            SetDropDownValue(model);
            return(View(model));
        }
コード例 #3
0
        public ActionResult Index(int?page)
        {
            int             currentPageIndex = page.HasValue ? page.Value : 1;
            int             defaultPageSize  = 30;
            FAQContentModel model            = new FAQContentModel();

            model.FAQContentList = _provider.GetList().ToPagedList(currentPageIndex, defaultPageSize);
            return(View(model));
        }
コード例 #4
0
 public ActionResult Edit(FAQContentModel model, int Id)
 {
     if (ModelState.IsValid)
     {
         model.FaqId = Id;
         var ts = (TravelSession)Session["TravelPortalSessionInfo"];
         model.UpdatedBy = ts.AppUserId;
         _provider.Edit(model);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
コード例 #5
0
 public ActionResult Create(FAQContentModel model)
 {
     if (ModelState.IsValid)
     {
         var ts = (TravelSession)Session["TravelPortalSessionInfo"];
         model.CreatedBy = ts.AppUserId;
         _provider.Save(model);
         return(RedirectToAction("Index"));
     }
     SetDropDownValue(model);
     return(View(model));
 }
コード例 #6
0
        public void Edit(FAQContentModel model)
        {
            var result = ent.FaqContent.Where(x => x.FaqId == model.FaqId).FirstOrDefault();

            result.HeadingId   = model.HeadingId;
            result.Question    = model.Question;
            result.Answer      = model.Answer;
            result.UpdatedBy   = model.UpdatedBy;
            result.UpdatedDate = DateTime.Now;
            ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
            ent.SaveChanges();
        }
コード例 #7
0
        public void Save(FAQContentModel model)
        {
            FaqContent result = new FaqContent();

            result.HeadingId   = model.HeadingId;
            result.Question    = model.Question;
            result.Answer      = model.Answer;
            result.StatusId    = true;
            result.CreatedBy   = model.CreatedBy;
            result.CreatedDate = DateTime.Now;
            ent.AddToFaqContent(result);
            ent.SaveChanges();
        }
コード例 #8
0
        public FAQContentModel Details(int FaqId)
        {
            FAQContentModel model  = new FAQContentModel();
            var             result = ent.FaqContent.Where(x => x.FaqId == FaqId).FirstOrDefault();

            if (result != null)
            {
                model.FaqId        = result.FaqId;
                model.HeadingId    = result.HeadingId;
                model.HeadingTitle = _provider.GetHeadingTitle(result.HeadingId);
                model.Question     = result.Question;
                model.Answer       = result.Answer;
                model.statusId     = result.StatusId;
                model.CreatedBy    = result.CreatedBy;
                model.CreatedDate  = result.CreatedDate;
                model.CreatorName  = ent.UsersDetails.Where(x => x.AppUserId == result.CreatedBy).Select(x => x.FullName).FirstOrDefault();
                model.UpdatedBy    = result.UpdatedBy;
                model.UpdatedDate  = result.UpdatedDate;
                model.UpdatorName  = ent.UsersDetails.Where(x => x.AppUserId == result.UpdatedBy).Select(x => x.FullName).FirstOrDefault();
            }
            return(model);
        }
コード例 #9
0
        public IEnumerable <FAQContentModel> GetList()
        {
            int sno = 0;
            List <FAQContentModel> ddlList = new List <FAQContentModel>();
            var result = ent.FaqContent;

            foreach (var item in result)
            {
                sno++;
                FAQContentModel obj = new FAQContentModel
                {
                    SNO          = sno,
                    FaqId        = item.FaqId,
                    Question     = item.Question,
                    HeadingTitle = _provider.GetHeadingTitle(item.HeadingId),
                    HeadingId    = item.HeadingId,
                    Answer       = item.Answer
                };
                ddlList.Add(obj);
            }
            return(ddlList.AsEnumerable());
        }
コード例 #10
0
 public void SetDropDownValue(FAQContentModel model)
 {
     model.ddlHeadingList = provider.SelectListOptions();
 }