This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "build", | |
"command": "dotnet", | |
"type": "process", | |
"args": [ | |
"build", | |
"${workspaceFolder}/{appPath}/{appName}.csproj", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": ".NET Core Launch (web)", | |
"type": "coreclr", | |
"request": "launch", | |
"preLaunchTask": "build", | |
"program": "${workspaceFolder}/{appPath}/{appName}.dll", | |
"args": [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace NetCoreBootstrap.Api.V1.Controllers | |
{ | |
[Route("/api/v1/[controller]/[action]")] | |
public class AccountApiController : Controller | |
{ | |
... | |
[HttpPost("SignIn")] | |
public async Task<object> SignIn([FromBody] UserVO userValueObject) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] | |
[HttpGet("AllResourceCategoryMetric")] | |
public IActionResult ResourceCategoryMetric(string startingDate) | |
{ | |
// TODO: roles not implemented yed, this metric is returns the same metric for any role | |
if (startingDate == string.Empty) | |
return BadRequest(Localizer["SelectATimePeriod"]); | |
var resources = UnitOfWork.ResourceRepository.GetAllWithRelatedEntitites().Where(ra => | |
ra.UpdatedAt >= DateTime.ParseExact(startingDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)) | |
.ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IEnumerable<Resource> GetSchoolGroupAccesedResources(int? schoolId, SchoolGroup schoolGroup, DateTime startingDate) | |
{ | |
var schoolGroupResources = schoolGroup | |
.SchoolGroupPrograms | |
.SelectMany(sgp => sgp.EducationalProgram.EducationalProgramResources) | |
.Select(epr => epr.Resource) | |
.Where(r => r.UpdatedAt > startingDate); | |
IEnumerable<int> schoolUserIds = null; | |
if (schooId != null) | |
schoolUserIds = school.Teachers.Select(t => t.TeacherId).Concat(school.Managers.Select(m => m.ManagerId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<IActionResult> CategoryMetric(string startingDate, int? schoolId) | |
{ | |
var currentUser = (await UserManager.FindByEmailAsync(User.Identity.Name)); | |
try | |
{ | |
if (GetSchoolToSearch(currentUser, schoolId) == null && !currentUser.IsInRole("Admin")) | |
return BadRequest(Localizer["UserIsNotSchoolGroupAdmin"]); | |
return Ok(GetSchoolGroupAccesedResources(schoolId, | |
currentUser.SchoolGroup, DateTime.ParseExact(startingDate, | |
"dd/MM/yyyy", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using EduitorNetCore.Models.Database; | |
using EduitorNetCore.Models.VOs.Reduceds; | |
using EduitorNetCore.Repositories.Database; | |
using EduitorNetCore.Repositories.Interfaces; | |
using Microsoft.EntityFrameworkCore; | |
namespace EduitorNetCore.Repositories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using Project.Repositories.Interfaces; | |
using Microsoft.EntityFrameworkCore; | |
namespace Project.Repositories | |
{ | |
public class Repository<T> : IRepository<T> where T : class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using Project.Repositories.Interfaces; | |
using Microsoft.EntityFrameworkCore; | |
namespace Project.Repositories | |
{ | |
public class Repository<T> : IRepository<T> where T : class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var keywords = new List<Tuple<int, string>>(); | |
foreach(var obj in response) | |
{ | |
var tuple = new Tuple<int, string>(Convert.ToInt32(obj), obj.ToString()); | |
keywords.Add(tuple); | |
} |
NewerOlder