public ActionResult Add(Video model, HttpPostedFileBase fileVideo) { if (ModelState.IsValid) { try { if (fileVideo.ContentLength > 0) { string _fileName = Path.GetFileName(fileVideo.FileName); string _path = Path.Combine(Server.MapPath("~/FileVideo"), _fileName); fileVideo.SaveAs(_path); model.videoBody = _fileName; _videoService.Add(model); _videoService.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Thêm mới video Id:" + model.videoId, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); return(RedirectToAction("Index")); } } catch (Exception ex) { } } var category = _videoService.Dropdownlist(0, model.parentId); ViewBag.parentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(model)); }
public ActionResult Detail(modelMenu entity) { if (ModelState.IsValid) { if (entity.menuId > 0) { var model = _services.GetById(entity.menuId); model.menuName = entity.menuName; model.menuUrl = entity.menuUrl; model.parentId = entity.parentId; model.isIcon = entity.isIcon; model.isSort = entity.isSort; model.isTaget = entity.isTaget; _services.Update(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Cập nhật danh mục Id:" + model.menuId, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } else { var model = new Menu(); model.menuName = entity.menuName; model.menuUrl = entity.menuUrl; model.parentId = entity.parentId; model.isIcon = entity.isIcon; model.isSort = entity.isSort; model.isTaget = entity.isTaget; model.isTrash = false; model.languageId = entity.languageId; _services.Add(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Thêm mới danh mục Id:" + model.menuId, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } return(RedirectToAction("Index", new { _parentId = entity.parentId })); } var category = _services.Dropdownlist(0, entity.menuId, entity.languageId); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public async Task <ActionResult> AddUser(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Thêm mới người dùng:" + model.Email, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); return(RedirectToAction("Index")); } AddErrors(result); } return(View(model)); }
public ActionResult Detail(LienKetWeb entity) { if (ModelState.IsValid) { if (entity.lienKetId > 0) { var model = _services.GetById(entity.lienKetId); model.lienKetName = entity.lienKetName; model.lienKetLink = entity.lienKetLink; model.isSort = entity.isSort; _services.Update(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Cập nhật liên kết website Id:" + model.lienKetId, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } else { var model = new LienKetWeb(); model.lienKetName = entity.lienKetName; model.isSort = entity.isSort; model.parentId = entity.parentId; model.lienKetLink = entity.lienKetLink; model.isTrash = false; _services.Add(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Thêm mới liên kết website Id:" + model.lienKetId, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } return(RedirectToAction("Index")); } return(View(entity)); }
public ActionResult DetailCategory(modelCategories entity) { if (ModelState.IsValid) { if (entity.Id > 0) { Content model = _services.GetById(entity.Id); if (entity.Alias.Contains("-" + entity.Id)) { model.contentAlias = entity.Alias; } else { model.contentAlias = entity.Alias + "-" + entity.Id; } model.contentDescription = entity.MetaDescription; model.contentId = entity.Id; model.contentThumbnail = entity.Img; model.contentTitle = entity.MetaTitle; model.updateTime = DateTime.Now; model.parentId = entity.ParentId; model.note = entity.Note; model.isHome = entity.IsHome; model.contentName = entity.Name; model.isSort = entity.No.Value; model.isTrash = false; model.contentKey = "cnews"; model.isSort = entity.No.GetValueOrDefault(); _services.Update(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Cập nhật chuyên mục tin tức Id:" + model.contentId + ":" + model.contentName, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } else { Content model = new Content { contentAlias = entity.Alias, contentDescription = entity.MetaDescription, contentId = entity.Id, contentThumbnail = entity.Img, contentTitle = entity.MetaTitle, updateTime = DateTime.Now, parentId = entity.ParentId, note = entity.Note, contentName = entity.Name, createTime = DateTime.Now, ngayBanHanh = DateTime.Now, isSort = entity.No.GetValueOrDefault(), isHome = entity.IsHome, isTrash = false, isView = 0, languageId = entity.LanguageId, contentKey = "cnews" }; _services.Add(model); _services.Save(); model.contentAlias = model.contentAlias + "-" + model.contentId; _services.Update(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Thêm mới chuyên mục tin tức Id:" + model.contentId + ":" + model.contentName, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } return(RedirectToAction("Category", new { _parentId = entity.ParentId })); } IEnumerable <DropdownModel> category = _services.Dropdownlist(0, entity.Id, "cnews", entity.LanguageId); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public ActionResult Detail(modelSuKienAnh entity) { if (ModelState.IsValid) { if (entity.Id > 0) { Content model = _services.GetById(entity.Id); if (entity.Alias.Contains("-" + entity.Id)) { model.contentAlias = entity.Alias; } else { model.contentAlias = entity.Alias + "-" + entity.Id; } model.contentBody = entity.BodyContent; model.contentDescription = entity.MetaDescription; model.contentId = entity.Id; model.contentThumbnail = entity.Img; model.contentTitle = entity.MetaTitle; if (string.IsNullOrEmpty(entity.CreateTime)) { model.updateTime = DateTime.Now; } else { model.updateTime = DateTime.ParseExact(entity.CreateTime, "dd/MM/yyyy", CultureInfo.InvariantCulture); } model.parentId = entity.ParentId; model.note = entity.Note; model.tacGia = entity.TacGia; model.isSort = entity.Sort; model.contentName = entity.Name; model.contentKey = "SuKienQuaAnh"; _services.Update(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Cập nhật sựa kiên qua ảnh Id:" + model.contentId + ":" + model.contentName, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } else { Content model = new Content { contentAlias = entity.Alias, contentBody = entity.BodyContent, contentDescription = entity.MetaDescription, contentId = entity.Id, contentThumbnail = entity.Img, contentTitle = entity.MetaTitle }; if (string.IsNullOrEmpty(entity.CreateTime)) { model.updateTime = DateTime.Now; } else { model.updateTime = DateTime.ParseExact(entity.CreateTime, "dd/MM/yyyy", CultureInfo.InvariantCulture); } model.parentId = entity.ParentId; model.note = entity.Note; model.tacGia = entity.TacGia; model.contentName = entity.Name; model.createTime = DateTime.Now; model.ngayBanHanh = DateTime.Now; model.isSort = entity.Sort; model.isTrash = false; model.isView = 0; model.languageId = entity.LanguageId; model.approval = false; model.contentKey = "SuKienQuaAnh"; _services.Add(model); _services.Save(); model.contentAlias = model.contentAlias + "-" + model.contentId; _services.Update(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Thêm mới sự kiện qua ảnh Id:" + model.contentId + ":" + model.contentName, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } return(RedirectToAction("Index", new { _parentId = entity.ParentId })); } IEnumerable <DropdownModel> category = _services.Dropdownlist(0, entity.Id, "csukienquaanh", entity.LanguageId); ViewBag.ParentId = category.Select(x => new SelectListItem { Text = x.Text, Value = x.Value.ToString() }); return(View(entity)); }
public ActionResult Detail(FeedbackModel entity) { if (ModelState.IsValid) { if (entity.feedbackId > 0) { var model = _services.GetById(entity.feedbackId); model.feedbackName = entity.feedbackName; model.feedbackBody = entity.feedbackBody; model.feedbackNote = entity.feedbackNote; model.updateTime = entity.updateTime; if (string.IsNullOrEmpty(entity.startDate)) { model.startDate = DateTime.Now; } else { model.startDate = DateTime.ParseExact(entity.startDate, "dd/MM/yyyy", CultureInfo.InvariantCulture); } if (string.IsNullOrEmpty(entity.endDate)) { model.endDate = DateTime.Now; } else { model.endDate = DateTime.ParseExact(entity.endDate, "dd/MM/yyyy", CultureInfo.InvariantCulture); } _services.Update(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Cập nhật ý kiến dóng góp Id:" + model.feedbackId, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } else { var model = new Feedback(); model.feedbackBody = entity.feedbackBody; model.feedbackName = entity.feedbackName; model.feedbackNote = entity.feedbackNote; if (string.IsNullOrEmpty(entity.startDate)) { model.startDate = DateTime.Now; } else { model.startDate = DateTime.ParseExact(entity.startDate, "dd/MM/yyyy", CultureInfo.InvariantCulture); } if (string.IsNullOrEmpty(entity.endDate)) { model.endDate = DateTime.Now; } else { model.endDate = DateTime.ParseExact(entity.endDate, "dd/MM/yyyy", CultureInfo.InvariantCulture); } model.createTime = DateTime.Now; model.updateTime = DateTime.Now; model.isEnd = false; model.isTrash = false; _services.Add(model); _services.Save(); _serviceLog.Add(new ActionLog { actionLogStatus = 1, actionLogTime = DateTime.Now, actionLogType = 1, actionNote = "Thêm mới ý kiến dóng góp Id:" + model.feedbackId, userIp = "", userName = User.Identity.Name }); _serviceLog.Save(); } return(RedirectToAction("Index")); } return(View(entity)); }