public async Task <IHttpActionResult> GetEventBoardReply(int id)
        {
            EventBoardReply eventBoardReply = await db.EventBoardReplies.FindAsync(id);

            if (eventBoardReply == null)
            {
                return(NotFound());
            }

            return(Ok(eventBoardReply));
        }
        public async Task <IHttpActionResult> PutEventBoardReply(int id, EventBoardReply boardReply)
        {
            PetterResultType <EventBoardReply> petterResultType  = new PetterResultType <EventBoardReply>();
            List <EventBoardReply>             eventBoardReplies = new List <EventBoardReply>();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            EventBoardReply eventBoardReply = await db.EventBoardReplies.FindAsync(id);

            if (eventBoardReply == null)
            {
                return(NotFound());
            }

            // 수정권한 체크
            if (eventBoardReply.MemberNo != boardReply.MemberNo)
            {
                return(BadRequest(ModelState));
            }

            eventBoardReply.Reply           = boardReply.Reply;
            eventBoardReply.StateFlag       = StateFlags.Use;
            eventBoardReply.DateModified    = DateTime.Now;
            db.Entry(eventBoardReply).State = EntityState.Modified;
            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            eventBoardReplies.Add(eventBoardReply);

            petterResultType.IsSuccessful = true;
            petterResultType.JsonDataSet  = eventBoardReplies;

            return(Ok(petterResultType));
        }
        public async Task <IHttpActionResult> PostEventBoardReply(EventBoardReply eventBoardReply)
        {
            PetterResultType <EventBoardReply> petterResultType  = new PetterResultType <EventBoardReply>();
            List <EventBoardReply>             eventBoardReplies = new List <EventBoardReply>();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            eventBoardReply.StateFlag    = StateFlags.Use;
            eventBoardReply.DateCreated  = DateTime.Now;
            eventBoardReply.DateModified = DateTime.Now;

            db.EventBoardReplies.Add(eventBoardReply);
            await db.SaveChangesAsync();

            eventBoardReplies.Add(eventBoardReply);
            petterResultType.IsSuccessful = true;
            petterResultType.JsonDataSet  = eventBoardReplies;
            return(Ok(petterResultType));
        }
        public async Task <IHttpActionResult> DeleteEventBoardReply(int id)
        {
            PetterResultType <EventBoardReply> petterResultType  = new PetterResultType <EventBoardReply>();
            List <EventBoardReply>             eventBoardReplies = new List <EventBoardReply>();
            EventBoardReply eventBoardReply = await db.EventBoardReplies.FindAsync(id);

            if (eventBoardReply == null)
            {
                return(NotFound());
            }

            eventBoardReply.StateFlag       = StateFlags.Delete;
            eventBoardReply.DateDeleted     = DateTime.Now;
            db.Entry(eventBoardReply).State = EntityState.Modified;

            await db.SaveChangesAsync();

            eventBoardReplies.Add(eventBoardReply);
            petterResultType.IsSuccessful = true;
            petterResultType.JsonDataSet  = eventBoardReplies;

            return(Ok(petterResultType));
        }