Exemple #1
0
        /// <summary>
        /// Function to find an entity by code .
        /// </summary>
        /// <param name="code">entity's code</param>
        /// <returns>response and information about the entity</returns>
        public ApiResponse FindByCode(string code)
        {
            ApiResponse response = new ApiResponse();

            try
            {
                response.Text = $"Entity with this code < {code} > was found . \n" +
                                $"{Serialization.Serizlize(Processor.FindByCode(code))}";
                response.Result = true;

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

                return(response);
            }
        }
        public Response FindByCode(string code)
        {
            Response response = new Response();

            try
            {
                response.Text   = "Entity with this code has been found :" + Environment.NewLine + JsonConverter.JsonConverter.ObjToJson(Processor.FindByCode(code));
                response.Result = true;
            }
            catch
            {
                response.Text   = $"There is no entity with the corresponding code: {code}.";
                response.Result = false;
            }
            return(response);
        }