Ejemplo n.º 1
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());
        }
Ejemplo n.º 2
0
        public ActionResult <ApiResultBaseModel> Create(
            [FromForm] string sTitle
            , [FromForm] BoardStateType typeBoardState
            , [FromForm] BoardAuthorityType nAuthorityDefault
            , [FromForm] string sMemo)
        {
            ApiResultReady rrResult = new ApiResultReady(this);


            DateTime dtNow = DateTime.Now;

            //유저 정보 추출
            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 newBoard = new Board();
                    newBoard.Title            = sTitle;
                    newBoard.BoardState       = typeBoardState;
                    newBoard.AuthorityDefault = (BoardAuthorityType)nAuthorityDefault;

                    //기능 설정
                    newBoard.BoardFaculty |= BoardFacultyType.ShowCount_Server;

                    newBoard.ShowCount  = 10;
                    newBoard.Memo       = sMemo;
                    newBoard.CreateDate = dtNow;

                    db1.Board.Add(newBoard);
                    db1.SaveChanges();


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

            return(rrResult.ToResult());
        }