Esempio n. 1
0
        public void AddParticipant(EventParticipantAddRequest model, int userId)
        {
            string procName = "[dbo].[EventParticipants_Insert]";

            _data.ExecuteNonQuery(procName, inputParamMapper : delegate(SqlParameterCollection col)
            {
                col.AddWithValue("@EventId", model.EventId);
                col.AddWithValue("@UserId", userId);
                col.AddWithValue("@ParticipantTypeId", model.ParticipantTypeId);
            },
                                  returnParameters: null);
        }
        public ActionResult <SuccessResponse> AddParticipant(EventParticipantAddRequest model)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                _service.AddParticipant(model, userId);

                response = new SuccessResponse();
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse($"Generic Errors: { ex.Message}");
                base.Logger.LogError(ex.ToString());
            }

            return(StatusCode(code, response));
        }