public IHttpActionResult Join(ParticipantToEventDTO pte)
        {
            ResponseMessage response = new ResponseMessage();

            if (pte.Validate() == false)
            {
                response.Code = 400;
                response.Body = "Event has not been liked.";
            }
            if (_service.Join(pte.Event_id))
            {
                response.Code = 201;
                response.Body = "Event has been liked.";
            }
            else
            {
                response.Code = 200;
                response.Body = "Event has not been liked.";
            }

            return(Json(response));
        }
예제 #2
0
        public IHttpActionResult Create(ParticipantToEventDTO pteDto)
        {
            ResponseMessage response = new ResponseMessage();

            if (pteDto.Validate() == false)
            {
                response.Code = 400;
                response.Body = "Invalid data - Connection has not been saved";

                return(Json(response));
            }
            if (_service.Save(pteDto))
            {
                response.Code = 201;
                response.Body = "Connection has been saved.";
            }
            else
            {
                response.Code = 200;
                response.Body = "Connection has not been saved.";
            }

            return(Json(response));
        }