Пример #1
0
        /// <summary>
        /// Delete a right from the object
        /// </summary>
        /// <param name="id">ID of organization to remove from</param>
        /// <param name="rId">ID of role</param>
        /// <param name="uId">ID of user in role</param>
        /// <param name="organizationId"></param>
        /// <returns></returns>
        public HttpResponseMessage Delete(int id, [FromUri] int rId, [FromUri] int uId, int organizationId)
        {
            try
            {
                var result = _organizationRightsService.RemoveRole(id, uId, (OrganizationRole)rId);

                return(result.Ok ?
                       Ok() :
                       FromOperationFailure(result.Error));
            }
            catch (Exception e)
            {
                return(Error(e));
            }
        }
Пример #2
0
        private IHttpActionResult PerformDelete(int key)
        {
            try
            {
                var result = _organizationRightsService.RemoveRole(key);

                if (result.Ok)
                {
                    return(StatusCode(HttpStatusCode.NoContent));
                }

                return(FromOperationFailure(result.Error));
            }
            catch (Exception e)
            {
                return(StatusCode(HttpStatusCode.InternalServerError));
            }
        }