Ejemplo n.º 1
0
        public Response FindByPK(long id)
        {
            Response response = new Response();

            try
            {
                Processor.Find(id);
                response.Text   = "Entity with this PK has been found :" + Environment.NewLine + JsonConverter.JsonConverter.ObjToJson(Processor.Find(id));
                response.Result = true;
            }
            catch
            {
                response.Text   = "An entity with this id does not exist.";
                response.Result = false;
            }
            return(response);
        }
Ejemplo n.º 2
0
        /// <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 ListAll()
        {
            UserProcessor = new UserProcessor();
            Response      = new ApiResponse();

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

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

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

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

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

                return(Response);
            }
        }