My controller:
[Route("api/[controller]")]
[ApiController]
public class CategoriesController : ControllerBase
{
private readonly IUnitOfWork unitOfWork;
public CategoriesController(IUnitOfWork unitOfWork)
{
this.unitOfWork = unitOfWork;
}
[HttpGet]
[Route("TestCategories")]
public ActionResult<IEnumerable<Category>> TestCategories()
{
return unitOfWork.Categories.FindAll().ToList();
}
}
My Startup:
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddDbContext<ClassifiedAdsDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddScoped<IUnitOfWork, UnitOfWork>();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
I did break my app so i can understand how the codes work.
As you can see on my controller i used IUnitOfWork (Interface that comes from MyProject.Domain - class library)
Scenario:
...
Hi, I would like to know, can we test the page manage permission even before the facebook app review permission are granted,if we edit correctly the users (admins/developers/testers) in the settings of our app. Thanks.
...I want to get data from related entity based on multiple conditions in a single query
I have two tables Employee(EmpId,EmpName) and Attendance(AttId,ScanType,ScanTime,EmpId), I want to display data for each month for all Employees. In Attendance table Scan type have multiple values for in-time and out-time. I want to select smallest value as in-time and largest value as out-time for each employee and store for each employee in view model. ViewModel(EmpId,In-time,Outtime).
What will be the query for this?
...
Hi, I'm using Oauth to login with facebook account as shown in the below image
When have clicking on the facebook button
...
I am trying to access a property of parent entity which is on one side of relation while in child entity but it is giving me null reference exception. May be its problem of lazy loading which is not available in entity framework core 2.0. How to access it in core 2.0. These are details of problem
...Hi, my app is still not aproved by facebook. I heve tried following this link https://qawithexperts.com/questions/351/error-requires-either-publishtogroups-permission-and-app-bei but still now, I haven't heard from facebook yet. I think to deal with apis pages under developement mode.
1 - I have created a new app under my account facebook , and keep the developement mode.
2 - I have get the page access token.
...
Hi. I need to create a login page where the user is requested to register using his Facebook page, instead of facebook Id, where he is the admin of the facebook page.
I'm using Oauth to login with facebook but want that user to register using his Facebook page for which user is the community manager(admin) while giving permissions to access page's fans information.
...Hi,
Facebook docs give this javascript code as shown below for oAuth login re-request
...