Ejemplo n.º 1
0
        public ActionResult <BoardListResultModel> List()
        {
            ApiResultReady       rrResult  = new ApiResultReady(this);
            BoardListResultModel armResult = new BoardListResultModel();

            rrResult.ResultObject = armResult;

            //유저 정보 추출
            ClaimModel cm = new ClaimModel(((ClaimsIdentity)User.Identity).Claims);
            //이 유저가 해당 관리 등급이 있는지 확인한다.
            ManagementClassCheckType typePC
                = GlobalStatic.MgtA.MgtClassCheck(cm.id_int
                                                  , ManagementClassType.Admin);

            if (typePC == ManagementClassCheckType.Ok)
            {
                using (SpaNetCoreFoundationContext db1 = new SpaNetCoreFoundationContext())
                {
                    armResult.List = db1.Board.ToList();
                }//end using db1
            }
            else
            {
                //에러
                rrResult.InfoCode = typePC.ToString();
            }

            return(rrResult.ToResult());
        }
Ejemplo n.º 2
0
        public ActionResult <ApiResultBaseModel> Edit(
            [FromForm] long nBoardId
            , [FromForm] string sTitle
            , [FromForm] short nShowCount
            , [FromForm] BoardStateType typeBoardState
            , [FromForm] BoardFacultyType typeBoardFaculty
            , [FromForm] BoardAuthorityType nAuthorityDefault
            , [FromForm] string sMemo)
        {
            ApiResultReady armResult = new ApiResultReady(this);

            //유저 정보 추출
            ClaimModel cm = new ClaimModel(((ClaimsIdentity)User.Identity).Claims);
            //이 유저가 해당 관리 등급이 있는지 확인한다.
            ManagementClassCheckType typePC
                = GlobalStatic.MgtA.MgtClassCheck(cm.id_int
                                                  , ManagementClassType.Admin);

            if (typePC == ManagementClassCheckType.Ok)
            {
                using (SpaNetCoreFoundationContext db1 = new SpaNetCoreFoundationContext())
                {
                    Board findBoard
                        = db1.Board
                          .Where(m => m.idBoard == nBoardId)
                          .FirstOrDefault();

                    if (null != findBoard)
                    {
                        findBoard.Title            = sTitle;
                        findBoard.ShowCount        = nShowCount;
                        findBoard.BoardState       = typeBoardState;
                        findBoard.BoardFaculty     = (BoardFacultyType)typeBoardFaculty;
                        findBoard.AuthorityDefault = (BoardAuthorityType)nAuthorityDefault;
                        findBoard.Memo             = sMemo;

                        db1.SaveChanges();

                        //게시판 정보 json으로 저장
                        GlobalStatic.FileProc.WWW_Json_BoardInfo();
                    }
                    else
                    {
                        armResult.InfoCode = typePC.ToString();
                        armResult.Message  = "대상이 없습니다.";
                    }
                }//end using db1
            }
            else
            {
                //에러
                armResult.InfoCode = ApiResultType.PermissionCheckError.ToString();
                armResult.Message  = "권한이 없습니다.";
            }

            return(armResult.ToResult());
        }