Exemplo n.º 1
0
        public ActionResult Index(int?page)
        {
            int             currentPageIndex = page.HasValue ? page.Value : 1;
            int             defaultPageSize  = 30;
            FAQHeadingModel model            = new FAQHeadingModel();

            model.FAQHeadingList = _provider.GetList().ToPagedList(currentPageIndex, defaultPageSize);
            return(View(model));
        }
Exemplo n.º 2
0
        public void Edit(FAQHeadingModel model)
        {
            var result = ent.FaqHeading.Where(x => x.HeadingId == model.HeadingId).FirstOrDefault();

            result.HeadingTitle = model.Title;
            result.UpdatedBy    = model.UpdatedBy;
            result.updatedDate  = DateTime.Now;
            ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
            ent.SaveChanges();
        }
Exemplo n.º 3
0
        public void Save(FAQHeadingModel model)
        {
            FaqHeading result = new FaqHeading();

            result.HeadingTitle = model.Title.Trim();
            result.CreatedBy    = model.CreatedBy;
            result.CreatedDate  = DateTime.Now;
            ent.AddToFaqHeading(result);
            ent.SaveChanges();
        }
Exemplo n.º 4
0
        public FAQHeadingModel GetDetails(int HeadingId)
        {
            FAQHeadingModel model  = new FAQHeadingModel();
            var             result = ent.FaqHeading.Where(x => x.HeadingId == HeadingId).FirstOrDefault();

            model.HeadingId   = result.HeadingId;
            model.Title       = result.HeadingTitle;
            model.CreatedBy   = result.CreatedBy;
            model.CreatedDate = result.CreatedDate;
            model.UpdatedBy   = result.UpdatedBy;
            model.UpdatedDate = result.updatedDate;
            return(model);
        }
Exemplo n.º 5
0
 public ActionResult Edit(FAQHeadingModel model, int Id)
 {
     if (ModelState.IsValid)
     {
         if (_provider.IfHeadingExists(model.Title, Id))
         {
             model.HeadingId = Id;
             var ts = (TravelSession)Session["TravelPortalSessionInfo"];
             model.UpdatedBy = ts.AppUserId;
             _provider.Edit(model);
             return(RedirectToAction("Index"));
         }
         TempData["Error"] = "Heading already exists";
         return(View(model));
     }
     return(View(model));
 }
Exemplo n.º 6
0
        public IEnumerable <FAQHeadingModel> GetList()
        {
            int sno = 0;
            List <FAQHeadingModel> ddlList = new List <FAQHeadingModel>();
            var result = ent.FaqHeading;

            foreach (var item in result)
            {
                sno++;
                FAQHeadingModel obj = new FAQHeadingModel
                {
                    SNO         = sno,
                    HeadingId   = item.HeadingId,
                    Title       = item.HeadingTitle,
                    CreatedBy   = item.CreatedBy,
                    CreatedDate = item.CreatedDate,
                    UpdatedBy   = item.UpdatedBy,
                    UpdatedDate = item.updatedDate,
                };
                ddlList.Add(obj);
            }
            return(ddlList.AsEnumerable());
        }
Exemplo n.º 7
0
        public ActionResult Edit(int Id)
        {
            FAQHeadingModel model = _provider.GetDetails(Id);

            return(View(model));
        }