コード例 #1
0
        public void Delete(int id)
        {
            Core_DashboardContentsB2C result = ent.Core_DashboardContentsB2C.Where(x => x.DashboardContentId == id).FirstOrDefault();

            ent.DeleteObject(result);
            ent.SaveChanges();
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
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();
            }
        }
コード例 #5
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);
        }