public ActionResult Edit(int Id, DashboardContentsModel model)
        {
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            model.DasbBoardContentId = Id;
            model.UpdatedBy          = obj.AppUserId;

            try
            {
                if (model.IsPublished == true)
                {
                    model.IsPublished = false;
                    ser.UpdateIsPublished(Id, model);


                    model.IsPublished = true;
                    ser.EditDashBoardContents(model);
                }
                else
                {
                    ser.EditDashBoardContents(model);
                }
            }
            catch
            {
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Detail(int Id)
        {
            DashboardContentsModel model = new DashboardContentsModel();

            model.DasbBoardContentId = Id;
            model = ser.GetCMSContent(Id);
            return(View(model));
        }
        public ActionResult Index()
        {
            TravelSession          obj   = (TravelSession)Session["TravelPortalSessionInfo"];
            DashboardContentsModel model = new DashboardContentsModel();

            model.ListDashboardContents = ser.GetDashBoardContentsList();
            return(View(model));
        }
Ejemplo n.º 4
0
        public DashboardContentsModel GetCMSContent(int id)
        {
            Core_DashboardContentsB2C result = ent.Core_DashboardContentsB2C.Where(x => x.DashboardContentId == id).FirstOrDefault();
            string Contents = string.Empty;

            if (result != null)
            {
                DashboardContentsModel model = new DashboardContentsModel();
                model.Body = ATLTravelPortal.Helpers.CMSContents.GetCMSContents(result.Body);
                return(model);
            }
            return(null);
        }
Ejemplo n.º 5
0
        public void UpdateIsPublished(int Id, DashboardContentsModel model)
        {
            List <Core_DashboardContentsB2C> result = ent.Core_DashboardContentsB2C.Where(u => u.DashboardContentId != Id).ToList();

            if (result != null)
            {
                foreach (var item in result)
                {
                    item.isPublished = model.IsPublished;
                    ent.ApplyCurrentValues(item.EntityKey.EntitySetName, item);
                    ent.SaveChanges();
                }
            }
        }
Ejemplo n.º 6
0
        public int CreateDashBoardContents(DashboardContentsModel model)
        {
            Core_DashboardContentsB2C obj = new Core_DashboardContentsB2C();

            obj.Title       = model.Title;
            obj.Body        = model.Body;
            obj.isPublished = model.IsPublished;
            obj.CreatedBy   = model.CreatedBy;
            obj.CreatedDate = DateTime.Now;

            ent.AddToCore_DashboardContentsB2C(obj);
            ent.SaveChanges();
            return(obj.DashboardContentId);
        }
        public ActionResult Index()
        {
            DashboardContentsModel model = new DashboardContentsModel();

            try
            {
                TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];
                model.ListDashboardContents = ser.GetDashBoardContentsList();
                return(View(model));
            }
            catch (Exception ex)
            {
                TempData["ActionResponse"] = ex.Message;
                return(View(model));
            }
        }
Ejemplo n.º 8
0
        public void EditDashBoardContents(DashboardContentsModel model)
        {
            Core_DashboardContentsB2C result = ent.Core_DashboardContentsB2C.Where(u => u.DashboardContentId == model.DasbBoardContentId).FirstOrDefault();

            if (result != null)
            {
                result.Title       = model.Title;
                result.Body        = model.Body;
                result.isPublished = model.IsPublished;
                result.UpdatedBy   = model.UpdatedBy;
                result.UpdatedDate = model.UpdatedDate;

                ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                ent.SaveChanges();
            }
        }
        public ActionResult Create(DashboardContentsModel model)
        {
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            model.CreatedBy = obj.AppUserId;
            try
            {
                int Id = ser.CreateDashBoardContents(model);
                model = ser.GetDashboardContentsDetail(Id);
                if (model.IsPublished == true)
                {
                    model.IsPublished = false;
                    ser.UpdateIsPublished(Id, model);
                }
            }
            catch
            {
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 10
0
        public List <DashboardContentsModel> GetDashBoardContentsList()
        {
            var result = ent.Core_DashboardContentsB2C;
            List <DashboardContentsModel> model = new List <DashboardContentsModel>();

            foreach (var item in result)
            {
                DashboardContentsModel obj = new DashboardContentsModel();
                obj.DasbBoardContentId = item.DashboardContentId;
                obj.Title       = item.Title;
                obj.Body        = item.Body;
                obj.CreatedBy   = item.CreatedBy;
                obj.CreatedName = item.UsersDetails.FullName;
                obj.CreatedDate = item.CreatedDate;
                obj.UpdatedBy   = item.UpdatedBy;
                obj.UpdatedName = item.UsersDetails.FullName;
                obj.UpdatedDate = item.UpdatedDate;
                obj.IsPublished = item.isPublished;
                model.Add(obj);
            }
            return(model.ToList());
        }
Ejemplo n.º 11
0
        public DashboardContentsModel GetDashboardContentsDetailByUserId(int Userid)
        {
            Core_DashboardContentsB2C result = ent.Core_DashboardContentsB2C.Where(x => x.CreatedBy == Userid).FirstOrDefault();

            if (result != null)
            {
                DashboardContentsModel model = new DashboardContentsModel();

                model.DasbBoardContentId = result.DashboardContentId;
                model.Title       = result.Title;
                model.Body        = result.Body;
                model.CreatedBy   = result.CreatedBy;
                model.CreatedName = result.UsersDetails.FullName;
                model.CreatedDate = result.CreatedDate;
                model.UpdatedBy   = result.UpdatedBy;
                model.UpdatedName = result.UsersDetails.FullName;
                model.UpdatedDate = result.UpdatedDate;

                return(model);
            }
            return(null);
        }
        public ActionResult Create()
        {
            DashboardContentsModel model = new DashboardContentsModel();

            return(View(model));
        }