Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="uID"></param>
        /// <param name="gID"></param>
        public void DeleteGroupIcon(string uID, string gID)
        {
            #region log user request and response

            /***********************************************
            *  To log user request
            ***********************************************/
            if (_logRequestResponse)
            {
                LogManager.CurrentInstance.InfoLogger.LogInfo(
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, System.Reflection.MethodBase.GetCurrentMethod().Name + "===>" +
                    "Request ===> senderID : " + uID + ", groupID : " + gID);
            }

            #endregion

            //#region Verify User
            //var request = OperationContext.Current.IncomingMessageProperties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
            //string keyFromClient = request.Headers["key"];
            //if (NeeoUtility.AuthenticateUserRequest(uID, keyFromClient))
            //{
            //    #endregion

            ulong temp = 0;

            if (NeeoUtility.IsNullOrEmpty(uID) || !ulong.TryParse(uID, out temp) ||
                NeeoUtility.IsNullOrEmpty(gID))
            {
                NeeoUtility.SetServiceResponseHeaders(CustomHttpStatusCode.InvalidArguments);
            }
            else
            {
                uID = uID.Trim();
                gID = gID.ToLower();
                try
                {
                    NeeoGroup.DeleteGroupIcon(groupID: gID, userID: uID);
                }
                catch (Exception exception)
                {
                    LogManager.CurrentInstance.ErrorLogger.LogError(
                        System.Reflection.MethodBase.GetCurrentMethod().DeclaringType,
                        System.Reflection.MethodBase.GetCurrentMethod().Name, exception);
                    NeeoUtility.SetServiceResponseHeaders(CustomHttpStatusCode.ServerInternalError);
                }
            }
            //}
            //else
            //{
            //    NeeoUtility.SetServiceResponseHeaders((CustomHttpStatusCode) HttpStatusCode.Unauthorized);

            //}
        }
Example #2
0
        public HttpResponseMessage Delete(string uId, string gID)
        {
            #region log user request and response

            /***********************************************
            *  To log user request
            ***********************************************/
            if (_logRequestResponse)
            {
                LogManager.CurrentInstance.InfoLogger.LogInfo(
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, System.Reflection.MethodBase.GetCurrentMethod().Name + "===>" +
                    "Request ===> senderID : " + uId + ", groupID : " + gID);
            }

            #endregion

            ulong temp = 0;

            if (NeeoUtility.IsNullOrEmpty(uId) || !ulong.TryParse(uId, out temp) ||
                NeeoUtility.IsNullOrEmpty(gID))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
            else
            {
                uId = uId.Trim();
                gID = gID.ToLower();
                try
                {
                    NeeoGroup.DeleteGroupIcon(groupID: gID, userID: uId);
                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                catch (Exception exception)
                {
                    LogManager.CurrentInstance.ErrorLogger.LogError(
                        System.Reflection.MethodBase.GetCurrentMethod().DeclaringType,
                        System.Reflection.MethodBase.GetCurrentMethod().Name, exception);

                    return(Request.CreateResponse(HttpStatusCode.InternalServerError));
                }
            }
        }