예제 #1
0
        public ApiResponse ListAll()
        {
            ModelProcessor = new ModelProcessor();
            Response       = new ApiResponse();

            try
            {
                ModelProcessor.Find();
                Response.text   = JsonConverter.JsonConverter.ObjToJson(ModelProcessor.Find());
                Response.result = true;

                return(Response);
            }
            catch
            {
                Response.text   = "Unfortunately something went wrong :(";
                Response.result = false;

                return(Response);
            }
        }
예제 #2
0
        public ApiResponse FindByPK(long id)
        {
            ModelProcessor = new ModelProcessor();
            Response       = new ApiResponse();

            try
            {
                ModelProcessor.Find(id);
                Response.text   = "Account with this PK has been found" + Environment.NewLine + JsonConverter.JsonConverter.ObjToJson(ModelProcessor.Find(id));
                Response.result = true;

                return(Response);
            }
            catch
            {
                Response.text   = "An account with this id does not exist";
                Response.result = false;

                return(Response);
            }
        }