public void ParticipantRemove(EventParticipantAdd model, int userId)
        {
            string procName = "[dbo].[EventParticipants_Delete]";

            _data.ExecuteNonQuery(procName, delegate(SqlParameterCollection inputCollection)
            {
                inputCollection.AddWithValue("@EventId", model.EventId);
                inputCollection.AddWithValue("@UserId", userId);
            }, null);
        }
Example #2
0
        public ActionResult <SuccessResponse> ParticipantRemove(EventParticipantAdd model)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                _service.ParticipantRemove(model, userId);
                response = new SuccessResponse();
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse($"Server Error {ex.Message}");
                base.Logger.LogError(ex.ToString());
            }

            return(StatusCode(code, response));
        }
Example #3
0
        public ActionResult <ItemResponse <int> > ParticipantAdd(EventParticipantAdd model)
        {
            int          code     = 201;
            BaseResponse response = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                int id     = _service.ParticipantAdd(model, userId);
                response = new ItemResponse <int> {
                    Item = id
                };
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse($"Server Error {ex.Message}");
                base.Logger.LogError(ex.ToString());
            }

            return(StatusCode(code, response));
        }
        //ADD & DELETE Event Participant
        public int ParticipantAdd(EventParticipantAdd model, int userId)
        {
            int    id       = 0;
            string procName = "[dbo].[EventParticipants_Insert]";

            _data.ExecuteNonQuery(procName, delegate(SqlParameterCollection col)
            {
                col.AddWithValue("@EventId", model.EventId);
                col.AddWithValue("@UserId", userId);
                col.AddWithValue("@ParticipantTypeId", 2);

                SqlParameter idOut = new SqlParameter("@Id", SqlDbType.Int);
                idOut.Direction    = ParameterDirection.Output;
                col.Add(idOut);
            }, returnParameters : delegate(SqlParameterCollection returnCollection)
            {
                object oId = returnCollection["@Id"].Value;
                int.TryParse(oId.ToString(), out id);
            });

            return(id);
        }