public IEnumerable <string> Get() { var result = QueriesOrCommands; QueriesOrCommands.Add("/events"); return(result); }
public bool DeleteBySearch(string value) { QueriesOrCommands.Add(nameof(DeleteContactBySearchCommand)); var command = new DeleteContactBySearchCommand { Value = value }; return(DeleteContactBySearch(command)); }
public IEnumerable <Contact> Search(string value) { QueriesOrCommands.Add(nameof(SearchContactsQuery)); var query = new SearchContactsQuery { Value = value }; return(SearchContacts(query)); }
public bool Delete(int id) { QueriesOrCommands.Add(nameof(DeleteContactCommand)); var command = new DeleteContactCommand { Id = id }; return(DeleteContact(command)); }
public int Get(int number1, int number2) { QueriesOrCommands.Add(nameof(AddNumbersQuery)); var query = new AddNumbersQuery { Number1 = number1, Number2 = number2 }; return(query.Number1 + query.Number2); }
public Contact Get(int id) { QueriesOrCommands.Add(nameof(GetContactByIdQuery)); var query = new GetContactByIdQuery { Id = id }; return(GetContactById(query)); }
public int Get(string @operator, int number1, int number2) { QueriesOrCommands.Add(nameof(CalculateQuery)); var query = new CalculateQuery { Operator = @operator, Number1 = number1, Number2 = number2 }; return(Calculate(query)); }
public IEnumerable <Contact> Get() { QueriesOrCommands.Add(nameof(GetContactsQuery)); var query = new GetContactsQuery(); var result = GetContacts(query); GetContactsQueryCount++; return(result); }
public static void Main(string[] args) { WebHost.CreateDefaultBuilder(args) .ConfigureServices(s => s.AddRouting()) .ConfigureServices(s => s.AddMvc()) .ConfigureServices(s => { s.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" }); c.GenerateTagadaSwaggerDoc(); }); }) .Configure(app => { app.Map("/api") .Get("/hello", () => "Hello world!") .Get("/add/{number1}/{number2}", (AddNumbersQuery query) => query.Number1 + query.Number2) .Get("/calculate/{operator}", Calculate) .Get("/contacts", GetContacts) .Get("/contacts/search", SearchContacts) .Get("/contacts/{id}", GetContactById) .Post("/contacts", CreateContact) .Put("/contacts", UpdateContact) .Delete("/contacts/search", DeleteContactBySearch) .Delete("/contacts/{id}", DeleteContact) .Get("/events", () => QueriesOrCommands) .Get("/count", () => GetContactsQueryCount) .AfterEach(routeResult => QueriesOrCommands.Add(routeResult.Input?.GetType().Name ?? routeResult.Path)) .AfterEach <GetContactsQuery>(_ => GetContactsQueryCount++) .AddSwagger() .Use(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); }); }) .Build() .Run(); }
public Contact Put([FromBody] UpdateContactCommand command) { QueriesOrCommands.Add(nameof(UpdateContactCommand)); return(UpdateContact(command)); }
public Contact Post([FromBody] CreateContactCommand command) { QueriesOrCommands.Add(nameof(CreateContactCommand)); return(CreateContact(command)); }
public int Get() { QueriesOrCommands.Add("/count"); return(GetContactsQueryCount); }
public string Get() { QueriesOrCommands.Add("/hello"); return("Hello world!"); }