public IEnumerable <ReaderData> Get(string id) { UserProfile _user = AuthManager.CurrentUser; if (_user == null) { throw ExceptionResponse.Forbidden(Request, Messages.InvalidCredentials); } try { return(null); } catch (NotFound ex) { throw ExceptionResponse.NotFound(Request, ex.Message); } catch (RequestForbidden ex) { throw ExceptionResponse.Forbidden(Request, ex.Message); } catch (Exception ex) { throw ExceptionResponse.ServerErrorResponse(Request); } }
public FileEditor Post(FileEditor file) { UserProfile _user = AuthManager.CurrentUser; if (_user == null) { throw ExceptionResponse.Forbidden(Request, Messages.InvalidCredentials); } try { const string fileName = "Unititled"; return(EditorServices.Create(file?.Name ?? fileName, _user.Id)); } catch (NotFound ex) { throw ExceptionResponse.NotFound(Request, ex.Message); } catch (RequestForbidden ex) { throw ExceptionResponse.Forbidden(Request, ex.Message); } catch (Exception) { throw ExceptionResponse.ServerErrorResponse(Request); } }
public IEnumerable <FileEditor> Get() { UserProfile _user = AuthManager.CurrentUser; if (_user == null) { throw ExceptionResponse.Forbidden(Request, Messages.InvalidCredentials); } try { IEnumerable <FileEditor> editors = EditorServices.GetAll(_user.Id); return(editors); } catch (NotFound ex) { throw ExceptionResponse.NotFound(Request, ex.Message); } catch (RequestForbidden ex) { throw ExceptionResponse.Forbidden(Request, ex.Message); } catch (Exception ex) { throw ExceptionResponse.ServerErrorResponse(Request); } }