Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome in the Category Application");
            commandlist();
            string input = "";

            CategoryApp app = new CategoryApp();

            do
            {
                input = Console.ReadLine();
                Console.WriteLine("");
                switch (input)
                {
                case "help":
                    commandlist();
                    Console.WriteLine("");
                    break;

                case "category:list":
                    app.ShowList();
                    Console.WriteLine("");
                    break;

                case "category:add":
                    app.Add();
                    Console.WriteLine("");
                    break;

                case "category:show":
                    app.Show();
                    Console.WriteLine("");
                    break;

                case "category:update":
                    app.Update();
                    Console.WriteLine("");
                    break;

                case "category:delete":
                    app.Delete();
                    Console.WriteLine("");
                    break;

                default:
                    Console.WriteLine("Command not found in the list. Use help to show the list.");
                    Console.WriteLine("");
                    break;
                }
            }while(input != "stop");
            Console.WriteLine("Thank you for using this application!");
            Console.WriteLine("");
        }
Ejemplo n.º 2
0
        public Response Delete([FromBody] string[] ids)
        {
            var result = new Response();

            try {
                _app.Delete(ids);
            } catch (Exception ex) {
                result.Code    = 500;
                result.Message = ex.InnerException?.Message ?? ex.Message;
            }

            return(result);
        }
Ejemplo n.º 3
0
        public string Delete(string[] ids)
        {
            Response resp = new Response();

            try
            {
                _app.Delete(ids);
            }
            catch (Exception e)
            {
                resp.Code    = 500;
                resp.Message = e.Message;
            }
            return(JsonHelper.Instance.Serialize(resp));
        }