Skip to content

Commit

Permalink
first cut
Browse files Browse the repository at this point in the history
  • Loading branch information
Shakti Singh committed May 3, 2020
0 parents commit 6aa8585
Show file tree
Hide file tree
Showing 41 changed files with 4,011 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}
Binary file added .vs/finora/v16/.suo
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
8 changes: 8 additions & 0 deletions AnswerProvider/AnswerProvider.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>


</Project>
37 changes: 37 additions & 0 deletions AnswerProvider/Controllers/SearchAnswerController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace AnswerProvider.Controllers
{
[ApiController]
[Route("[controller]")]
public class SearchAnswerController : ControllerBase
{
private readonly ILogger<SearchAnswerController> _logger;

public SearchAnswerController(ILogger<SearchAnswerController> logger)
{
_logger = logger;
}

[HttpGet]
public string Get()
{
int Category = 0;
int QuestionType = 0;
SearchAnswer obj = new SearchAnswer();
return obj.GetAnswer(Category, QuestionType);
}

[HttpGet("{Category}/{QuestionType}")]
public string Get(int Category, int QuestionType)
{
SearchAnswer obj = new SearchAnswer();
return obj.GetAnswer(Category, QuestionType);
}
}
}
26 changes: 26 additions & 0 deletions AnswerProvider/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace AnswerProvider
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
30 changes: 30 additions & 0 deletions AnswerProvider/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50607",
"sslPort": 44354
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "searchanswer",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"AnswerProvider": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "searchanswer",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
52 changes: 52 additions & 0 deletions AnswerProvider/SearchAnswer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;

namespace AnswerProvider
{
public class SearchAnswer
{
public int Category { get; set; }
public int QuestionType { get; set; }
public string GetAnswer(int Category, int QuestionType)
{
string answer = string.Empty;
if(Category == 0 && QuestionType == 0)
{
answer = @"Please Entert Category and Question Type.
For Personal Finace : Category - 1, Question Type - 1
For Mutual Funds : Categoty - 2, Question Type - 1
For Stock Markets : Categoty - 3, Question Type - 1
For Bonds : Categoty - 4, Question Type - 1
For Others : Categoty - 5, Question Type - 1";
return answer;
}
else if(Category == 1 && QuestionType == 1)
{
answer = @"Personal Finance is the first step towrads financial knowledge.
Keep an eye on your expenses.
You should save first and then plan your expensens of what is left out.
People ususally do opposite of it.";
return answer;
}
else if (Category == 2 && QuestionType == 1)
{
answer = @"Mutual Funds are usueful when you have a goal and want to save for it.
Like buying a Car, Home or a vacation.
But there is market risk also involved.";
return answer;
}
else if (Category == 3 && QuestionType == 1)
{
answer = @"Stock Market is a place where you can buy a stock
and become a partner of the company whoes share you buy.
It will help you generate a secondary income in form of dividends.";
return answer;
}
else
{
answer = @"Please enter a valid category and question type.";
return answer;
}

}
}
}
51 changes: 51 additions & 0 deletions AnswerProvider/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace AnswerProvider
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseHttpsRedirection();

app.UseRouting();

app.UseAuthorization();

app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
9 changes: 9 additions & 0 deletions AnswerProvider/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
10 changes: 10 additions & 0 deletions AnswerProvider/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
Loading

0 comments on commit 6aa8585

Please sign in to comment.