Example #1
0
        public Response FindByPK(long id)
        {
            Response response = new Response();

            try
            {
                Processor.Find(id);
                response.Text   = "Account with this PK has been found :" + Environment.NewLine + JsonConverter.JsonConverter.ObjToJson(Processor.Find(id));
                response.Result = true;
            }
            catch
            {
                response.Text   = "An account with this id does not exist.";
                response.Result = false;
            }
            return(response);
        }
        public ApiResponse ListAll()
        {
            AccountStatusProcessor = new AccountStatusProcessor();
            Response = new ApiResponse();

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

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

                return(Response);
            }
        }
        /// <summary>
        /// Function to find an entity by id .
        /// </summary>
        /// <param name="id">entity id</param>
        /// <returns>response and information about the entity</returns>
        public ApiResponse FindByPk(long id)
        {
            ApiResponse response = new ApiResponse();

            try
            {
                Processor.Find(id);
                response.Text = $"Entity with this primary key < {id} > was found . \n" +
                                $"{Serialization.Serizlize(Processor.Find(id))}";

                response.Result = true;

                return(response);
            }
            catch (Exception ex)
            {
                response.Result = false;
                response.Text   = ex.Message;

                return(response);
            }
        }
        public ApiResponse FindByPK(long id)
        {
            AccountStatusProcessor = new AccountStatusProcessor();
            Response = new ApiResponse();

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

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

                return(Response);
            }
        }