コード例 #1
0
        public async Task <ActionResult> DeleteEvent(int eventId)
        {
            try
            {
                await _eventService.DeleteAsync(eventId);
            }
            catch (FaultException <ServiceValidationFaultDetails> exception)
            {
                string error = string.Empty;

                if (exception.Message.Equals("Not allowed to delete. Event has locked seat", StringComparison.OrdinalIgnoreCase))
                {
                    error = ProjectResources.ResourceErrors.DeleteEventError;
                }

                return(Json(new
                {
                    success = false,
                    error
                }));
            }
            catch (FaultException exception)
            {
                return(Json(new
                {
                    success = false,
                    error = exception.Message
                }));
            }

            return(Json(new
            {
                success = true
            }));
        }