Exemplo n.º 1
0
        public ActionResult SaveRegist(gov_album item) {
            if (Session.getCurrentUser() == null)
                return Redirect("/admin/account/logon");
            if (!SercurityServices.HasPermission((int)TypeModule.MODULE_MEDIA, Session.getCurrentUser().username, TypeAudit.Album))
            {
                return Redirect("/admin/error/error403");
            }
            item.total_view = 0;
            item.update_username = "******";
            item.update_datetime = DateTime.Now;

            item = _cnttDB.gov_album.Add(item);
            try
            {
                int rs = _cnttDB.SaveChanges();
                if (rs > 0)
                {
                    insertHistory(AccessType.themMoiAlbum, Constant.THEM(Constant.ITEM_ALBUM, Constant.ID, item.id.ToString()));
                    TempData["message"] = Constant.REGIST_SUCCESSFULL;
                }
                else
                {
                    TempData["err"] = Constant.REGIST_ERR;
                }
            } catch(Exception ex){
                TempData["err"] = Constant.REGIST_ERR;
            }
            return Redirect("Index");
        }
Exemplo n.º 2
0
        public ActionResult SaveEdit(gov_album item)
        {
            if (Session.getCurrentUser() == null)
                return Redirect("/admin/account/logon");
            if (!SercurityServices.HasPermission((int)TypeModule.MODULE_MEDIA, Session.getCurrentUser().username, TypeAudit.Album))
            {
                return Redirect("/admin/error/error403");
            }
            gov_album albumInfo = _cnttDB.gov_album.Find(item.id);
            if (albumInfo == null)
                return Redirect("/admin/error/error405");
            albumInfo.album_title = item.album_title;
            albumInfo.description = item.description;
            albumInfo.avatar = item.avatar;
            albumInfo.order_number = item.order_number;
            albumInfo.update_username = Session.getCurrentUser().username;
            albumInfo.update_datetime = DateTime.Now;
            try
            {
                int rs = _cnttDB.SaveChanges();
                if (rs > 0)
                {
                    insertHistory(AccessType.chinhSuaAlbum, Constant.CHINHSUA(Constant.ITEM_ALBUM, Constant.ID, item.id.ToString()));
                    TempData["message"] = Constant.EDIT_SUCCESSFULL;
                }
                else {
                    TempData["err"] = Constant.EDIT_ERR;
                }
            }
            catch (Exception ex)
            {

            }
            return Redirect("Index");
        }