public async Task<IHttpActionResult> PutEvent(int id, Event @event)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != @event.EventNo)
            {
                return BadRequest();
            }

            db.Entry(@event).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EventExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public async Task<IHttpActionResult> PostEvent()
        {
            
            EventDetailsDTO @eventDetail = new EventDetailsDTO();
            Event @event = new Event();
            List<EventPicture> @eventPictureList = new List<EventPicture>();
            EventPicture @eventPicture = new EventPicture();
            PatterResultType @patterResultType = new PatterResultType();

            if (!Request.Content.IsMimeMultipartContent())
            {
                //throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
            }

            var folder = HostingEnvironment.MapPath(UploadPath.PATH);

            Utilities.CreateDirectory(folder);

            var provider = new CustomMultipartFormDataStreamProvider(folder);

            try
            {
                await Request.Content.ReadAsMultipartAsync(provider);

                // Show all the key-value pairs.
                foreach (var key in provider.FormData)
                {
                    foreach (var val in provider.FormData.GetValues(key.ToString()))
                    {
                        switch (key.ToString())
                        {
                            case "EventNo":
                                @event.EventNo = int.Parse(val);
                                break;
                            case "WriteId":
                                @event.WriteId = val;
                                break;
                            case "Title":
                                @event.Title = val;
                                break;
                            case "Content":
                                @event.Content = val;
                                break;
                            default:
                                break;
                        }
                    }
                }

                db.Events.Add(@event);
                await db.SaveChangesAsync();

                foreach (MultipartFileData file in provider.FileData)
                {
                    //Trace.WriteLine("Server file name: " + file.Headers.ContentDisposition.FileName);
                    //Trace.WriteLine("Server file path: " + file.LocalFileName);
                    @eventPicture.EventNo = @event.EventNo;
                    @eventPicture.PictureName = file.Headers.ContentDisposition.FileName;
                    @eventPicture.PicturePath = file.LocalFileName;
                    db.EventPictures.Add(@eventPicture);
                    await db.SaveChangesAsync();

                    //@eventDetail.EventPictures.Add(@eventPicture);
                }

                @eventDetail.EventNo = @event.EventNo;
                @eventDetail.WriteId = @event.WriteId;
                @eventDetail.Title = @event.Title;
                @eventDetail.Content = @event.Content;
                //var picture = db.EventPictures.FindAsync(@event.EventNo);
                //@eventDetail.EventPictures = picture.
                //@eventDetail.EventPictures = 
                //foreach (var item in @eventPicture)
                //{
                //    @eventDTO.EventPictures.Add(item);
                //}
                //@event.EventPictures = @eventPictureList;


                //return Request.CreateResponse(HttpStatusCode.OK, @event.ToString());
                //var result = new List<ListItems>();

                @patterResultType.JsonDataSet = @eventDetail.ToString();
                @patterResultType.IsSuccessful = true;

                //return new JsonResult{ Data = result};
                return Ok(@patterResultType);
            }
            catch (System.Exception e)
            {
                //return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e);
                return InternalServerError(e);
            }
        }