addfunfacts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-05-19 17:56:56 +02:00
parent 8cd1e10cd7
commit 634488c2d8
107 changed files with 5270 additions and 289 deletions

View File

@@ -1,11 +1,14 @@
using HanyadikHetVan.DTO;
using HanyadikHetVan.Data.Entities;
using HanyadikHetVan.DTO;
using HanyadikHetVan.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Net.Mime;
using System.Security.Claims;
using System.Threading.Tasks;
namespace HanyadikHetVan.Controllers.V2
@@ -16,10 +19,12 @@ namespace HanyadikHetVan.Controllers.V2
public class WeeklyTimeSpanController: Controller
{
private readonly WeeklyTimeSpanService _weeklytimespanService;
private readonly UserManager<User> _userManager;
public WeeklyTimeSpanController(WeeklyTimeSpanService weeklytimespanService)
public WeeklyTimeSpanController(WeeklyTimeSpanService weeklytimespanService, UserManager<User> userManager)
{
_weeklytimespanService = weeklytimespanService;
_userManager = userManager ?? throw new ArgumentNullException(nameof(userManager));
}
[HttpPost]
[Authorize]
@@ -31,7 +36,7 @@ namespace HanyadikHetVan.Controllers.V2
{
try
{
var obj = await _weeklytimespanService.AddWeeklyTimeSpan(weeklytimespan);
var obj = await _weeklytimespanService.AddWeeklyTimeSpan(this.User.FindFirst(ClaimTypes.NameIdentifier).Value,weeklytimespan);
return CreatedAtAction(nameof(GetWeeklyTimeSpanById), new { weeklytimespanId = obj.Id }, obj);
}
catch (Exception)