public ActionResult CapNhat(int Id) { if (Id > 0) { var entity = _services.GetById(Id); var model = new ModelContent { contentAlias = entity.contentAlias, contentDescription = entity.contentDescription, contentThumbnail = entity.contentThumbnail, contentMetaTitle = entity.contentMetaTitle, contentParentId = entity.contentParentId, contentMetaDescription = entity.contentMetaDescription, contentName = entity.contentName, contentCreateTime = entity.contentCreateTime.ToString("dd/MM/yyyy"), contentCreateUser = User.Identity.Name, contentMetaKeywords = entity.contentMetaKeywords, contentUpdateUser = User.Identity.Name, contentBody = entity.contentBody, isFeature = (entity.isFeature ?? false), isNew = (entity.isNew ?? false) }; IEnumerable <DropdownModel> category = _services.Dropdownlist(0, (int)model.contentId, "CHUYENMUCDAOTAO", 1); ViewBag.contentParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(model)); } else { return(View()); } }
public ActionResult getAnh() { try { _languageId = (int)Session["languageId"]; } catch { } int Id = 0; if (_languageId == 1) { int.TryParse(_configSystemServices.GetValueByKey("BoxHinhAnh"), out Id); } else { int.TryParse(_configSystemServices.GetValueByKey("BoxHinhAnhEn"), out Id); } var entity = _services.GetAll2(null, null, null, Id, "SuKienQuaAnh", _languageId, false, true, null, null); var model = _services.GetById(Id); ViewBag.Url = model.note; return(PartialView(entity.Contents.ToList())); }
public ActionResult CapNhat(int Id) { if (Id > 0) { var entity = _services.GetById(Id); var model = new ModelChuyenMuc { Id = entity.contentId, Link = entity.contentAlias, MetaDescription = entity.contentMetaDescription, MetaKeywords = entity.contentMetaKeywords, MetaTitle = entity.contentMetaTitle, Name = entity.contentName, Note = entity.contentDescription, Isort = entity.isSort, ParentId = entity.contentParentId, Thumbnail = entity.contentThumbnail }; IEnumerable <DropdownModel> category = _services.Dropdownlist(0, (int)model.Id, "CHUYENMUCTINTUC", 1); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(model)); } else { return(View()); } }
public ActionResult Detail(int?Id) { ModelLichCongTac entity; if (Id.HasValue && Id > 0) { Content model = _services.GetById(Id.Value); entity = new ModelLichCongTac { Id = model.contentId, Link = model.contentAlias, Name = model.contentName, Body = model.contentBody }; ViewBag.Title = "Cập nhật lịch công tác toàn trường"; } else { entity = new ModelLichCongTac { Id = 0 }; ViewBag.Title = "Thêm mới lịch công tác toàn trường"; } return(View(entity)); }
public ActionResult DetailCategory(int?Id) { modelCategories entity; string cookieLanguage = "1"; if (Request.Cookies["cookieLanguage"] != null) { cookieLanguage = Request.Cookies["cookieLanguage"].Value.ToString(); } int.TryParse(cookieLanguage, out int _languageId); if (Id.HasValue && Id > 0) { Content model = _services.GetById(Id.Value); entity = new modelCategories { Id = model.contentId, Alias = model.contentAlias, Img = model.contentThumbnail, LanguageId = model.languageId, MetaDescription = model.contentDescription, MetaKeywords = model.contentKeywords, MetaTitle = model.contentTitle, Name = model.contentName, Note = model.note, ParentId = model.parentId, IsHome = (model.isHome ?? false) }; if (model.isHome.HasValue) { entity.IsHome = model.isHome.Value; } else { entity.IsHome = false; } entity.No = model.isSort; ViewBag.Title = "Cập nhật chuyên mục ấn phẩm tài liệu"; } else { entity = new modelCategories { LanguageId = _languageId }; ViewBag.Title = "Thêm mới chuyên mục ấn phẩm tài liệu"; } IEnumerable <DropdownModel> category = _services.Dropdownlist(0, entity.Id, "cdisanvanhoa", _languageId); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public ActionResult DetailCategory(int?Id) { string cookieLanguage = "1"; if (Request.Cookies["cookieLanguage"] != null) { cookieLanguage = Request.Cookies["cookieLanguage"].Value.ToString(); } int.TryParse(cookieLanguage, out _languageId); modelCategories entity; if (Id.HasValue && Id > 0) { var model = _services.GetById(Id.Value); entity = new modelCategories(); entity.Id = model.contentId; entity.Alias = model.contentAlias; entity.Img = model.contentThumbnail; entity.LanguageId = model.languageId; entity.MetaDescription = model.contentDescription; entity.MetaKeywords = model.contentKeywords; entity.MetaTitle = model.contentTitle; entity.Name = model.contentName; entity.Note = model.note; entity.ParentId = model.parentId; if (model.isHome.HasValue) { entity.IsHome = model.isHome.Value; } else { entity.IsHome = false; } entity.No = model.isSort; ViewBag.Title = "Cập nhật chuyên mục ấn phẩm tài liệu"; } else { entity = new modelCategories { LanguageId = _languageId }; ViewBag.Title = "Thêm mới chuyên mục ấn phẩm tài liệu"; } var category = _services.Dropdownlist(0, entity.Id, "canphamtailieu", _languageId); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public ActionResult Detail(int?Id) { var _user = _db.UserLogins.Find(User.Identity.Name); if (_user != null && _user.sessionId != HttpContext.Session.SessionID) { AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); } int _languageId = 1; Content model = null; if (Id.HasValue && Id > 0) { model = _services.GetById(Id.Value); ViewBag.Title = "Cập nhật văn bản"; } else { model = new Content { contentId = 0, languageId = _languageId, createTime = DateTime.Now, approvedTime = DateTime.Now, ngayDang = DateTime.Now, allowComment = false, isHome = false, isNew = false, parentId = null, approved = false, approvedUser = User.Identity.Name, createUser = User.Identity.Name, isSort = 0, isTrash = false, isFeature = false, isView = 0, modifiedTime = DateTime.Now, modifiedUser = User.Identity.Name, contentKey = "Document", metaTitle = "" }; ViewBag.Title = "Thêm mới văn bản"; } IEnumerable <DropdownModel> category = _services.Dropdownlist(0, null, "ChuyenMucDocument", _languageId); ViewBag.parentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(model)); }
public ActionResult Detail(int?Id) { modelSuKienAnh entity; string cookieLanguage = "1"; if (Request.Cookies["cookieLanguage"] != null) { cookieLanguage = Request.Cookies["cookieLanguage"].Value.ToString(); } int.TryParse(cookieLanguage, out int _languageId); if (Id.HasValue && Id > 0) { Content model = _services.GetById(Id.Value); entity = new modelSuKienAnh { Id = model.contentId, Alias = model.contentAlias, BodyContent = model.contentBody, CreateTime = model.updateTime.ToString("dd/MM/yyyy"), Img = model.contentThumbnail, LanguageId = model.languageId, MetaDescription = model.contentDescription, MetaKeywords = model.contentKeywords, MetaTitle = model.contentTitle, Name = model.contentName, Note = model.note, TacGia = model.tacGia, ParentId = model.parentId, Sort = model.isSort }; ViewBag.Title = "Cập nhật sự kiện ảnh"; } else { entity = new modelSuKienAnh { CreateTime = DateTime.Now.ToString("dd/MM/yyyy"), LanguageId = _languageId, Alias = Guid.NewGuid().ToString() }; ViewBag.Title = "Thêm mới sự kiện ảnh"; } IEnumerable <DropdownModel> category = _services.Dropdownlist(0, entity.Id, "csukienquaanh", _languageId); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public ActionResult DetailCategory(int?Id) { modelCategories entity; int _languageId = 1; if (Id.HasValue && Id > 0) { Content model = _services.GetById(Id.Value); entity = new modelCategories { Id = model.contentId, Alias = model.contentAlias, Img = model.contentThumbnail, LanguageId = model.languageId, MetaDescription = model.contentDescription, MetaKeywords = model.contentKeywords, MetaTitle = model.contentTitle, Name = model.contentName, Note = model.note, ParentId = model.parentId }; if (model.isHome.HasValue) { entity.IsHome = model.isHome.Value; } else { entity.IsHome = false; } entity.No = model.isSort; ViewBag.Title = "Cập nhật chuyên mục thông tin di sản văn hóa"; } else { entity = new modelCategories { LanguageId = _languageId }; ViewBag.Title = "Thêm mới chuyên mục thông tin di sản văn hóa"; } IEnumerable <DropdownModel> category = _services.Dropdownlist(0, entity.Id, "cthongtindisanvanhoa", _languageId); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public ActionResult Detail(int?Id) { var _user = _db.UserLogins.Find(User.Identity.Name); if (_user != null && _user.sessionId != HttpContext.Session.SessionID) { AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); } int _languageId = 1; Content model = null; if (Id.HasValue && Id > 0) { model = _services.GetById(Id.Value); ViewBag.Title = "Cập nhật hình ảnh"; } else { model = new Content { contentId = 0, languageId = _languageId, createTime = DateTime.Now, approvedTime = DateTime.Now, ngayDang = DateTime.Now, allowComment = false, isHome = false, isNew = false, parentId = null, approved = false, approvedUser = User.Identity.Name, createUser = User.Identity.Name, isSort = 0, isTrash = false, isFeature = false, isView = 0, modifiedTime = DateTime.Now, modifiedUser = User.Identity.Name, contentKey = "Gallery" }; ViewBag.Title = "Thêm mới hình ảnh"; } return(View(model)); }
public ActionResult Detail(int?Id, int?ParentId) { ModelMedia entity; if (Id.HasValue && Id > 0) { Content model = _services.GetById(Id.Value); entity = new ModelMedia { Id = (int)model.contentId, Alias = model.contentAlias, BodyContent = model.contentBody, CreateTime = model.contentUpdateTime.ToString("dd/MM/yyyy"), Img = model.contentThumbnail, LanguageId = 1, MetaDescription = model.contentDescription, MetaKeywords = model.contentMetaKeywords, MetaTitle = model.contentMetaTitle, Name = model.contentName, Note = model.contentDescription, ParentId = (int)model.contentParentId, Sort = model.isSort, TacGia = model.authorize }; ViewBag.Title = "Cập nhật media"; } else { entity = new ModelMedia { CreateTime = DateTime.Now.ToString("dd/MM/yyyy"), LanguageId = 1, ParentId = ParentId }; ViewBag.Title = "Thêm mới media"; } IEnumerable <DropdownModel> category = _services.Dropdownlist(0, entity.Id, "CHUYENMUCMEDIA", 1); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public ActionResult Detail(int?Id) { ModelContent entity; int _languageId = 1; if (Id.HasValue && Id > 0) { Content model = _services.GetById(Id.Value); entity = new ModelContent { contentId = model.contentId, contentAlias = model.contentAlias, contentBody = model.contentBody, contentThumbnail = model.contentThumbnail, contentDescription = model.contentDescription, contentMetaKeywords = model.contentMetaKeywords, contentMetaTitle = model.contentMetaTitle, contentName = model.contentName, contentMetaDescription = model.contentMetaDescription, contentParentId = model.contentParentId, authorize = model.authorize, isNew = model.isNew ?? false, isFeature = model.isFeature ?? false, contentCreateTime = model.contentCreateTime.ToString("dd/MM/yyyy") }; ViewBag.Title = "Cập nhật tin tức"; } else { entity = new ModelContent { contentId = 0 }; ViewBag.Title = "Thêm mới tin tức"; } IEnumerable <DropdownModel> category = _services.Dropdownlist(0, null, "CHUYENMUCTINTUC", _languageId); ViewBag.contentParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public ActionResult CapNhat(int Id) { if (Id > 0) { var entity = _services.GetById(Id); var model = new ModelLichCongTac { Id = entity.contentId, Link = entity.contentAlias, Name = entity.contentName, Body = entity.contentBody, ParentId = entity.contentParentId }; if (User.IsInRole("Admin")) { IEnumerable <DropdownModel> category = _services.Dropdownlist(0, (int)model.Id, "DONVIPHONGKHOA", 1); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); } else { var um = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext())); var user = um.FindById(User.Identity.GetUserId()); var _roleUser = user.Roles.FirstOrDefault(); ApplicationDbContext db = new ApplicationDbContext(); var role = db.Roles.Find(_roleUser.RoleId); var _Trained = _servicesRoleFunction.GetByUserNameCode(role.Name, "TRAINED"); IEnumerable <DropdownModel> category = _services.Dropdownlist2(_Trained.ChuyenMucId.GetValueOrDefault(), (int)model.Id, "DONVIPHONGKHOA", 1); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); } return(View(model)); } else { return(View()); } }
public ActionResult Detail(int?Id) { int _languageId = 1; Content model = null; if (Id.HasValue && Id > 0) { model = _services.GetById(Id.Value); ViewBag.Title = "Cập nhật trang"; } else { model = new Content { contentId = 0, languageId = _languageId, createTime = DateTime.Now, approvedTime = DateTime.Now, ngayDang = DateTime.Now, allowComment = false, isHome = false, isNew = false, parentId = null, approved = false, approvedUser = User.Identity.Name, createUser = User.Identity.Name, isSort = 0, isTrash = false, isFeature = false, isView = 0, modifiedTime = DateTime.Now, modifiedUser = User.Identity.Name, contentKey = "Page" }; ViewBag.Title = "Thêm mới trang"; } return(View(model)); }
public ActionResult CapNhat(int Id) { if (Id > 0) { var entity = _services.GetById(Id); var model = new ModelDonVi { DonViId = entity.contentId, Link = entity.contentAlias, TenDonVi = entity.contentName, DonviCha = entity.contentParentId }; IEnumerable <DropdownModel> category = _services.Dropdownlist(0, (int)model.DonViId, "DONVIPHONGKHOA", 1); ViewBag.DonviCha = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(model)); } else { return(View()); } }
public ActionResult Detail(int?Id) { ModelBanner entity; if (Id.HasValue && Id > 0) { var model = _services.GetById(Id.Value); entity = new ModelBanner { Id = model.contentId, Alias = model.contentAlias, BodyContent = model.contentBody, Img = model.contentThumbnail, Name = model.contentName, ParentId = model.contentParentId, IsSort = model.isSort, IsTrash = model.isTrash, Link = model.contentDescription }; ViewBag.Title = "Cập nhật banner"; } else { entity = new ModelBanner { Id = 0 }; ViewBag.Title = "Thêm mới banner"; } var category = _services.Dropdownlist(0, (int)entity.Id, "BANNER", _languageId); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public ActionResult getBreadcrumb(string pageUrl) { var entity = _services.GetByAlias(pageUrl); if (entity != null && entity.contentParentId.HasValue) { var model = _services.GetById((int)entity.contentParentId.Value); if (model != null) { ViewBag.PTitle = getParent(model.contentParentId) + "<a href=\"" + model.contentAlias + "\">" + model.contentName + "</a> >> " + entity.contentName; } } else if (entity != null) { ViewBag.PTitle = "<a href=\"/\">Trang chủ</a> >> " + entity.contentName; } return(PartialView()); }