Skip to content

Instantly share code, notes, and snippets.

@CoreProgramm
Created February 1, 2020 16:40
Show Gist options
  • Save CoreProgramm/e14e723b390cab21b98b1d1a8a46ce7b to your computer and use it in GitHub Desktop.
Save CoreProgramm/e14e723b390cab21b98b1d1a8a46ce7b to your computer and use it in GitHub Desktop.
Difference between AddSingleton vs AddScoped vs AddTransient in asp.net core
@model Mobile
@inject IMobileService mobiledata
@{
ViewData["Title"] = "Create";
}
<form asp-controller="home" asp-action="create" method="post">
<div>
<label asp-for="name"></label>
<div>
<input asp-for="name">
</div>
</div>
<div>
<label asp-for="model"></label>
<div>
<input asp-for="model">
</div>
</div>
<div>
<label asp-for="price"></label>
<div>
<input asp-for="price">
</div>
</div>
<div>
<button type="submit">Create</button>
</div>
<div>
Total Employees Count = @mobiledata.GetAll().Count().ToString()
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment