コード例 #1
0
        /// <summary>
        /// Delete a sheet.
        /// </summary>
        /// <param name="id">Id of the sheet to be deleted.</param>
        /// <returns></returns>
        public async Task <ActionResult> DeleteSheet(Guid?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }
            try
            {
                var identity = HttpContext.User.Identity as ClaimsIdentity;
                var userId   = Guid.Parse(identity.Claims.First(claim => claim.Type == "Id").Value);
                await _service.DeleteSheet(id, userId);

                return(Ok());
            }
            catch (SecurityException)
            {
                return(Unauthorized());
            }
            catch
            {
                return(BadRequest());
            }
        }