This commit is contained in:
parent
4d4455679c
commit
8347b10401
@ -1,73 +0,0 @@
|
||||
using HanyadikHetVan.Data.Entities;
|
||||
using HanyadikHetVan.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Controllers
|
||||
{
|
||||
[Route("api/pauses")]
|
||||
[ApiController]
|
||||
public class PauseController
|
||||
{
|
||||
private readonly PauseService _pauseService;
|
||||
|
||||
public PauseController(PauseService pauseService)
|
||||
{
|
||||
_pauseService = pauseService;
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<Object> AddPause([FromBody] Pause pause)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _pauseService.AddPause(pause);
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
[HttpDelete("{pauseId}")]
|
||||
public bool DeletePause(int pauseId)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pauseService.DeletePause(pauseId);
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
[HttpPut]
|
||||
public bool UpdatePause([FromBody] Pause pause)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pauseService.UpdatePause(pause);
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public Object GetAllPauses()
|
||||
{
|
||||
var data = _pauseService.GetAllPauses();
|
||||
var json = JsonConvert.SerializeObject(data, Formatting.Indented,
|
||||
new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
}
|
||||
);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace HanyadikHetVan.Controllers
|
||||
{
|
||||
[Route("api/test")]
|
||||
[ApiController]
|
||||
public class TestController : ControllerBase
|
||||
{
|
||||
[HttpGet("unprotected")]
|
||||
public string Unprotected()
|
||||
{
|
||||
|
||||
return "Unprotected";
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpGet("protected")]
|
||||
public string Protected()
|
||||
{
|
||||
|
||||
return "Protected";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Controllers
|
||||
{
|
||||
public class UserController
|
||||
{
|
||||
}
|
||||
}
|
@ -1,12 +1,14 @@
|
||||
using HanyadikHetVan.DTO;
|
||||
using HanyadikHetVan.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net.Mime;
|
||||
|
||||
namespace HanyadikHetVan.Controllers
|
||||
namespace HanyadikHetVan.Controllers.V1
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/hanyadikhetvan")]
|
||||
public class HanyadikHetVanController : ControllerBase
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/v{version:apiVersion}/[controller]")]
|
||||
public class HanyadikHetVanController : Controller
|
||||
{
|
||||
|
||||
private readonly HanyadikHetVanJsonService _jsonservice;
|
||||
@ -20,7 +22,8 @@ namespace HanyadikHetVan.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("json")]
|
||||
[Consumes("application/json")]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public HanyadikHetVanDTO GetJson()
|
||||
{
|
||||
return _jsonservice.HanyadikHetVan();
|
37
HanyadikHetVan/Controllers/V1/TestController.cs
Normal file
37
HanyadikHetVan/Controllers/V1/TestController.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace HanyadikHetVan.Controllers.V1
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/v{version:apiVersion}/[controller]")]
|
||||
[ApiController]
|
||||
public class TestController : Controller
|
||||
{
|
||||
private UserManager<IdentityUser> _userManager;
|
||||
|
||||
public TestController(UserManager<IdentityUser> userManager)
|
||||
{
|
||||
_userManager = userManager ?? throw new ArgumentNullException(nameof(userManager));
|
||||
}
|
||||
|
||||
[HttpGet("unprotected")]
|
||||
[Produces("application/json")]
|
||||
public string Unprotected()
|
||||
{
|
||||
|
||||
return "Unprotected";
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpGet("protected")]
|
||||
[Produces("application/json")]
|
||||
public string Protected()
|
||||
{
|
||||
return this.User.FindFirst(ClaimTypes.NameIdentifier).Value;
|
||||
}
|
||||
}
|
||||
}
|
53
HanyadikHetVan/Controllers/V2/HanyadikHetVanController.cs
Normal file
53
HanyadikHetVan/Controllers/V2/HanyadikHetVanController.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using HanyadikHetVan.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Controllers.V2
|
||||
{
|
||||
[ApiController]
|
||||
[ApiVersion("2.0")]
|
||||
[Route("api/v{version:apiVersion}/[controller]")]
|
||||
public class HanyadikHetVanController : Controller
|
||||
{
|
||||
private readonly HanyadikHetVanEntityService _hanyadikHetVanEntityService;
|
||||
|
||||
public HanyadikHetVanController(HanyadikHetVanEntityService hanyadikHetVanEntityService)
|
||||
{
|
||||
_hanyadikHetVanEntityService = hanyadikHetVanEntityService ?? throw new ArgumentNullException(nameof(hanyadikHetVanEntityService));
|
||||
}
|
||||
|
||||
[HttpGet("{weeklytimespanId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(int))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetWeekById(int weeklytimespanId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var wts = await _hanyadikHetVanEntityService.GetWeekById(weeklytimespanId);
|
||||
return Ok(wts);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(int))]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<IActionResult> GetDefaultWeek()
|
||||
{
|
||||
try
|
||||
{
|
||||
var wts = await _hanyadikHetVanEntityService.GetDefaultWeek();
|
||||
return Ok(wts);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
100
HanyadikHetVan/Controllers/V2/PauseController.cs
Normal file
100
HanyadikHetVan/Controllers/V2/PauseController.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using HanyadikHetVan.DTO;
|
||||
using HanyadikHetVan.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Mime;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Controllers.V2
|
||||
{
|
||||
[ApiVersion("2.0")]
|
||||
[Route("api/v{version:apiVersion}/[controller]")]
|
||||
[ApiController]
|
||||
public class PauseController : Controller
|
||||
{
|
||||
private readonly PauseService _pauseService;
|
||||
|
||||
public PauseController(PauseService pauseService)
|
||||
{
|
||||
_pauseService = pauseService;
|
||||
}
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[ProducesResponseType(StatusCodes.Status201Created, Type = typeof(WeeklyTimeSpanDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<IActionResult> AddPause([FromBody] PauseDTO pause)
|
||||
{
|
||||
try
|
||||
{
|
||||
var obj = await _pauseService.AddPause(pause);
|
||||
return CreatedAtAction(nameof(GetPauseById),new { pauseId = obj.Id } ,obj);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
[HttpDelete("{pauseId}")]
|
||||
[Authorize]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WeeklyTimeSpanDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<IActionResult> DeletePause(int pauseId)
|
||||
{
|
||||
var result = await _pauseService.DeletePause(pauseId);
|
||||
if (result)
|
||||
{
|
||||
return Ok(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
[HttpPut]
|
||||
[Authorize]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PauseDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<IActionResult> UpdatePause([FromBody] PauseDTO pause)
|
||||
{
|
||||
try
|
||||
{
|
||||
var obj = await _pauseService.UpdatePause(pause);
|
||||
return Ok(obj);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<List<PauseDTO>> GetAllPauses()
|
||||
{
|
||||
return await _pauseService.GetAllPauses();
|
||||
}
|
||||
|
||||
[HttpGet("{pauseId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PauseDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetPauseById(int pauseId)
|
||||
{
|
||||
var pause = await _pauseService.GetPause(pauseId);
|
||||
if (pause == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(pause);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
63
HanyadikHetVan/Controllers/V2/PurseController.cs
Normal file
63
HanyadikHetVan/Controllers/V2/PurseController.cs
Normal file
@ -0,0 +1,63 @@
|
||||
using HanyadikHetVan.DTO;
|
||||
using HanyadikHetVan.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Mime;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Controllers.V2
|
||||
{
|
||||
[ApiVersion("2.0")]
|
||||
[Route("api/v{version:apiVersion}/[controller]")]
|
||||
[ApiController]
|
||||
public class PurseController : Controller
|
||||
{
|
||||
private readonly PurseService _purseService;
|
||||
|
||||
public PurseController(PurseService purseService)
|
||||
{
|
||||
_purseService = purseService ?? throw new ArgumentNullException(nameof(purseService));
|
||||
}
|
||||
|
||||
[HttpPut("{userId}")]
|
||||
[Authorize]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PurseDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<IActionResult> SetBalanceOfUser(string userId, [FromBody] PurseDTO pause)
|
||||
{
|
||||
try
|
||||
{
|
||||
var obj = await _purseService.SetBalanceOfUser(userId, pause.Balance);
|
||||
return Ok(obj);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{userId}")]
|
||||
[Authorize]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(PurseDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<IActionResult> GetPauseById(string userId)
|
||||
{
|
||||
var purse = await _purseService.GetBalanceOfUser(userId);
|
||||
if (purse == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(purse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
129
HanyadikHetVan/Controllers/V2/WeeklyTimeSpanController.cs
Normal file
129
HanyadikHetVan/Controllers/V2/WeeklyTimeSpanController.cs
Normal file
@ -0,0 +1,129 @@
|
||||
using HanyadikHetVan.DTO;
|
||||
using HanyadikHetVan.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Mime;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Controllers.V2
|
||||
{
|
||||
[ApiVersion("2.0")]
|
||||
[Route("api/v{version:apiVersion}/[controller]")]
|
||||
[ApiController]
|
||||
public class WeeklyTimeSpanController: Controller
|
||||
{
|
||||
private readonly WeeklyTimeSpanService _weeklytimespanService;
|
||||
|
||||
public WeeklyTimeSpanController(WeeklyTimeSpanService weeklytimespanService)
|
||||
{
|
||||
_weeklytimespanService = weeklytimespanService;
|
||||
}
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[ProducesResponseType(StatusCodes.Status201Created, Type = typeof(WeeklyTimeSpanDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<IActionResult> AddWeeklyTimeSpan([FromBody] WeeklyTimeSpanDTO weeklytimespan)
|
||||
{
|
||||
try
|
||||
{
|
||||
var obj = await _weeklytimespanService.AddWeeklyTimeSpan(weeklytimespan);
|
||||
return CreatedAtAction(nameof(GetWeeklyTimeSpanById), new { weeklytimespanId = obj.Id }, obj);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
[HttpDelete("{weeklyTimeSpanId}")]
|
||||
[Authorize]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(bool))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<IActionResult> DeleteWeeklyTimeSpan(int weeklyTimeSpanId)
|
||||
{
|
||||
var result = await _weeklytimespanService.DeleteWeeklyTimeSpan(weeklyTimeSpanId);
|
||||
if (result)
|
||||
{
|
||||
return Ok(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
[HttpPut]
|
||||
[Authorize]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WeeklyTimeSpanDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<IActionResult> UpdateWeeklyTimeSpan([FromBody] WeeklyTimeSpanDTO weeklytimespan)
|
||||
{
|
||||
try
|
||||
{
|
||||
var wts = await _weeklytimespanService.UpdateWeeklyTimeSpan(weeklytimespan);
|
||||
return Ok(wts);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
[HttpGet("date/{startTime}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WeeklyTimeSpanDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetAllWeeklyTimeSpanByStartdate(DateTime startTime)
|
||||
{
|
||||
var wts = await _weeklytimespanService.GetWeeklyTimeSpanByStartdate(startTime);
|
||||
if (wts == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(wts);
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<List<WeeklyTimeSpanDTO>> GetAllWeeklyTimespans()
|
||||
{
|
||||
return await _weeklytimespanService.GetAllWeeklyTimeSpans();
|
||||
}
|
||||
[HttpGet("{weeklytimespanId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WeeklyTimeSpanDTO))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetWeeklyTimeSpanById(int weeklytimespanId)
|
||||
{
|
||||
var wts = await _weeklytimespanService.GetWeeklyTimeSpan(weeklytimespanId);
|
||||
if (wts == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(wts);
|
||||
}
|
||||
}
|
||||
[HttpGet("pauses/{weeklytimespanId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(List<PauseDTO>))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetAllPausesOfTimeSpan(int weeklytimespanId)
|
||||
{
|
||||
var wts = await _weeklytimespanService.GetPausesOfWeeklyTimeSpan(weeklytimespanId);
|
||||
if (wts == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(wts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
using HanyadikHetVan.Data.Entities;
|
||||
using HanyadikHetVan.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Controllers
|
||||
{
|
||||
[Route("api/weeklytimespans")]
|
||||
[ApiController]
|
||||
public class WeeklyTimeSpanController
|
||||
{
|
||||
private readonly WeeklyTimeSpanService _weeklytimespanService;
|
||||
|
||||
public WeeklyTimeSpanController(WeeklyTimeSpanService weeklytimespanService)
|
||||
{
|
||||
_weeklytimespanService = weeklytimespanService;
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<Object> AddWeeklyTimeSpan([FromBody] WeeklyTimeSpan weeklytimespan)
|
||||
{
|
||||
try
|
||||
{
|
||||
var obj = await _weeklytimespanService.AddWeeklyTimeSpan(weeklytimespan);
|
||||
return obj;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
[HttpDelete("{weeklyTimeSpanId}")]
|
||||
public bool DeleteWeeklyTimeSpan(int weeklyTimeSpanId)
|
||||
{
|
||||
return _weeklytimespanService.DeleteWeeklyTimeSpan(weeklyTimeSpanId);
|
||||
}
|
||||
[HttpPut]
|
||||
public bool UpdateWeeklyTimeSpan([FromBody] WeeklyTimeSpan weeklytimespan)
|
||||
{
|
||||
try
|
||||
{
|
||||
_weeklytimespanService.UpdateWeeklyTimeSpan(weeklytimespan);
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
[HttpGet("date/{startTime}")]
|
||||
public Object GetAllWeeklyTimeSpanByStartdate(DateTime startTime)
|
||||
{
|
||||
var data = _weeklytimespanService.GetWeeklyTimeSpanByStartdate(startTime);
|
||||
var json = JsonConvert.SerializeObject(data, Formatting.Indented,
|
||||
new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
}
|
||||
);
|
||||
return json;
|
||||
}
|
||||
[HttpGet]
|
||||
public Object GetAllWeeklyTimespans()
|
||||
{
|
||||
var data = _weeklytimespanService.GetAllWeeklyTimeSpans();
|
||||
var json = JsonConvert.SerializeObject(data, Formatting.Indented,
|
||||
new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
}
|
||||
);
|
||||
return json;
|
||||
}
|
||||
[HttpGet("{weeklytimespanId}")]
|
||||
public Object GetWeeklyTimeSpanById(int weeklytimespanId)
|
||||
{
|
||||
var data = _weeklytimespanService.GetWeeklyTimeSpan(weeklytimespanId);
|
||||
var json = JsonConvert.SerializeObject(data, Formatting.Indented,
|
||||
new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
}
|
||||
);
|
||||
return json;
|
||||
}
|
||||
[HttpGet("pauses/{weeklytimespanId}")]
|
||||
public Object GetAllPausesOfTimeSpan(int weeklytimespanId)
|
||||
{
|
||||
var data = _weeklytimespanService.GetPausesOfWeeklyTimeSpan(weeklytimespanId);
|
||||
var json = JsonConvert.SerializeObject(data, Formatting.Indented,
|
||||
new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
}
|
||||
);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
}
|
12
HanyadikHetVan/DTO/PauseDTO.cs
Normal file
12
HanyadikHetVan/DTO/PauseDTO.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace HanyadikHetVan.DTO
|
||||
{
|
||||
public class PauseDTO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int WeeklyTimeSpanId { get; set; }
|
||||
public DateTime Startdate { get; set; }
|
||||
public DateTime Enddate { get; set; }
|
||||
}
|
||||
}
|
7
HanyadikHetVan/DTO/PurseDTO.cs
Normal file
7
HanyadikHetVan/DTO/PurseDTO.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace HanyadikHetVan.DTO
|
||||
{
|
||||
public class PurseDTO
|
||||
{
|
||||
public int Balance { get; set; }
|
||||
}
|
||||
}
|
27
HanyadikHetVan/DTO/WeeklyTimeSpanDTO.cs
Normal file
27
HanyadikHetVan/DTO/WeeklyTimeSpanDTO.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.DTO
|
||||
{
|
||||
public class WeeklyTimeSpanDTO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public DateTime Startdate { get; set; }
|
||||
|
||||
public virtual ICollection<PauseDTO> Pauses { get; set; }
|
||||
|
||||
public int CurrentWeek
|
||||
{
|
||||
get
|
||||
{
|
||||
TimeSpan allPause = this.Pauses.Aggregate(TimeSpan.Zero, (sumSoFar, nextPause) => sumSoFar + (nextPause.Enddate - nextPause.Startdate));
|
||||
|
||||
TimeSpan wtsLength = DateTime.Now - this.Startdate;
|
||||
|
||||
return (wtsLength - allPause).Days / 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,6 +9,8 @@ namespace HanyadikHetVan.Data
|
||||
public DbSet<Pause> Pauses { get; set; }
|
||||
public DbSet<WeeklyTimeSpan> WeeklyTimeSpans { get; set; }
|
||||
|
||||
public DbSet<Purse> Purses { get; set; }
|
||||
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
|
@ -1,13 +1,21 @@
|
||||
using System;
|
||||
using HanyadikHetVan.DTO;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace HanyadikHetVan.Data.Entities
|
||||
{
|
||||
public class Pause
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int WeeklyTimeSpanId { get; set; }
|
||||
|
||||
public virtual WeeklyTimeSpan WeeklyTimeSpan { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime Startdate { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime Enddate { get; set; }
|
||||
}
|
||||
}
|
||||
|
19
HanyadikHetVan/Data/Entities/Purse.cs
Normal file
19
HanyadikHetVan/Data/Entities/Purse.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Data.Entities
|
||||
{
|
||||
public class Purse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public virtual IdentityUser User { get; set; }
|
||||
|
||||
public String UserId { get; set; }
|
||||
|
||||
public int Balance { get; set; }
|
||||
}
|
||||
}
|
@ -1,13 +1,21 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace HanyadikHetVan.Data.Entities
|
||||
{
|
||||
public class WeeklyTimeSpan
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime Startdate { get; set; }
|
||||
|
||||
public virtual ICollection<Pause> Pauses { get; set; }
|
||||
|
||||
public virtual IdentityUser Owner { get; set; }
|
||||
|
||||
public String OwnerId { get; set; }
|
||||
}
|
||||
}
|
||||
|
345
HanyadikHetVan/Data/Migrations/20210518232039_AddOwnerToWeeklyTimeSpan.Designer.cs
generated
Normal file
345
HanyadikHetVan/Data/Migrations/20210518232039_AddOwnerToWeeklyTimeSpan.Designer.cs
generated
Normal file
@ -0,0 +1,345 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using HanyadikHetVan.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace HanyadikHetVan.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20210518232039_AddOwnerToWeeklyTimeSpan")]
|
||||
partial class AddOwnerToWeeklyTimeSpan
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.6")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Pause", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime>("Enddate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("Startdate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("WeeklyTimeSpanId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WeeklyTimeSpanId");
|
||||
|
||||
b.ToTable("Pauses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("OwnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTime>("Startdate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("WeeklyTimeSpans");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex")
|
||||
.HasFilter("[NormalizedName] IS NOT NULL");
|
||||
|
||||
b.ToTable("AspNetRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex")
|
||||
.HasFilter("[NormalizedUserName] IS NOT NULL");
|
||||
|
||||
b.ToTable("AspNetUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Pause", b =>
|
||||
{
|
||||
b.HasOne("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", "WeeklyTimeSpan")
|
||||
.WithMany("Pauses")
|
||||
.HasForeignKey("WeeklyTimeSpanId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("WeeklyTimeSpan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId");
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.Navigation("Pauses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace HanyadikHetVan.Data.Migrations
|
||||
{
|
||||
public partial class AddOwnerToWeeklyTimeSpan : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "OwnerId",
|
||||
table: "WeeklyTimeSpans",
|
||||
type: "nvarchar(450)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WeeklyTimeSpans_OwnerId",
|
||||
table: "WeeklyTimeSpans",
|
||||
column: "OwnerId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_WeeklyTimeSpans_AspNetUsers_OwnerId",
|
||||
table: "WeeklyTimeSpans",
|
||||
column: "OwnerId",
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_WeeklyTimeSpans_AspNetUsers_OwnerId",
|
||||
table: "WeeklyTimeSpans");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_WeeklyTimeSpans_OwnerId",
|
||||
table: "WeeklyTimeSpans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OwnerId",
|
||||
table: "WeeklyTimeSpans");
|
||||
}
|
||||
}
|
||||
}
|
348
HanyadikHetVan/Data/Migrations/20210519014822_AddPruse.Designer.cs
generated
Normal file
348
HanyadikHetVan/Data/Migrations/20210519014822_AddPruse.Designer.cs
generated
Normal file
@ -0,0 +1,348 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using HanyadikHetVan.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace HanyadikHetVan.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20210519014822_AddPruse")]
|
||||
partial class AddPruse
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.6")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Pause", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime>("Enddate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("Startdate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("WeeklyTimeSpanId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WeeklyTimeSpanId");
|
||||
|
||||
b.ToTable("Pauses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("OwnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("Price")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("Startdate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("WeeklyTimeSpans");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex")
|
||||
.HasFilter("[NormalizedName] IS NOT NULL");
|
||||
|
||||
b.ToTable("AspNetRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex")
|
||||
.HasFilter("[NormalizedUserName] IS NOT NULL");
|
||||
|
||||
b.ToTable("AspNetUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Pause", b =>
|
||||
{
|
||||
b.HasOne("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", "WeeklyTimeSpan")
|
||||
.WithMany("Pauses")
|
||||
.HasForeignKey("WeeklyTimeSpanId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("WeeklyTimeSpan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId");
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.Navigation("Pauses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
24
HanyadikHetVan/Data/Migrations/20210519014822_AddPruse.cs
Normal file
24
HanyadikHetVan/Data/Migrations/20210519014822_AddPruse.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace HanyadikHetVan.Data.Migrations
|
||||
{
|
||||
public partial class AddPruse : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Price",
|
||||
table: "WeeklyTimeSpans",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Price",
|
||||
table: "WeeklyTimeSpans");
|
||||
}
|
||||
}
|
||||
}
|
345
HanyadikHetVan/Data/Migrations/20210519014936_RemovePrice.Designer.cs
generated
Normal file
345
HanyadikHetVan/Data/Migrations/20210519014936_RemovePrice.Designer.cs
generated
Normal file
@ -0,0 +1,345 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using HanyadikHetVan.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace HanyadikHetVan.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20210519014936_RemovePrice")]
|
||||
partial class RemovePrice
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.6")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Pause", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime>("Enddate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("Startdate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("WeeklyTimeSpanId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WeeklyTimeSpanId");
|
||||
|
||||
b.ToTable("Pauses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("OwnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTime>("Startdate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("WeeklyTimeSpans");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex")
|
||||
.HasFilter("[NormalizedName] IS NOT NULL");
|
||||
|
||||
b.ToTable("AspNetRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex")
|
||||
.HasFilter("[NormalizedUserName] IS NOT NULL");
|
||||
|
||||
b.ToTable("AspNetUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Pause", b =>
|
||||
{
|
||||
b.HasOne("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", "WeeklyTimeSpan")
|
||||
.WithMany("Pauses")
|
||||
.HasForeignKey("WeeklyTimeSpanId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("WeeklyTimeSpan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId");
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.Navigation("Pauses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
24
HanyadikHetVan/Data/Migrations/20210519014936_RemovePrice.cs
Normal file
24
HanyadikHetVan/Data/Migrations/20210519014936_RemovePrice.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace HanyadikHetVan.Data.Migrations
|
||||
{
|
||||
public partial class RemovePrice : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Price",
|
||||
table: "WeeklyTimeSpans");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Price",
|
||||
table: "WeeklyTimeSpans",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
}
|
||||
}
|
374
HanyadikHetVan/Data/Migrations/20210519022840_AddPurseToContext.Designer.cs
generated
Normal file
374
HanyadikHetVan/Data/Migrations/20210519022840_AddPurseToContext.Designer.cs
generated
Normal file
@ -0,0 +1,374 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using HanyadikHetVan.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace HanyadikHetVan.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20210519022840_AddPurseToContext")]
|
||||
partial class AddPurseToContext
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.6")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Pause", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<DateTime>("Enddate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("Startdate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("WeeklyTimeSpanId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WeeklyTimeSpanId");
|
||||
|
||||
b.ToTable("Pauses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Purse", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Balance")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Purses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("OwnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTime>("Startdate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("WeeklyTimeSpans");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex")
|
||||
.HasFilter("[NormalizedName] IS NOT NULL");
|
||||
|
||||
b.ToTable("AspNetRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex")
|
||||
.HasFilter("[NormalizedUserName] IS NOT NULL");
|
||||
|
||||
b.ToTable("AspNetUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Pause", b =>
|
||||
{
|
||||
b.HasOne("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", "WeeklyTimeSpan")
|
||||
.WithMany("Pauses")
|
||||
.HasForeignKey("WeeklyTimeSpanId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("WeeklyTimeSpan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Purse", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId");
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.Navigation("Pauses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace HanyadikHetVan.Data.Migrations
|
||||
{
|
||||
public partial class AddPurseToContext : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Purses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
UserId = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
||||
Balance = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Purses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Purses_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Purses_UserId",
|
||||
table: "Purses",
|
||||
column: "UserId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Purses");
|
||||
}
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ namespace HanyadikHetVan.Data.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.5")
|
||||
.HasAnnotation("ProductVersion", "5.0.6")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Pause", b =>
|
||||
@ -42,6 +42,26 @@ namespace HanyadikHetVan.Data.Migrations
|
||||
b.ToTable("Pauses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Purse", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Balance")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Purses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -49,11 +69,16 @@ namespace HanyadikHetVan.Data.Migrations
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("OwnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTime>("Startdate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("WeeklyTimeSpans");
|
||||
});
|
||||
|
||||
@ -268,6 +293,24 @@ namespace HanyadikHetVan.Data.Migrations
|
||||
b.Navigation("WeeklyTimeSpan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.Purse", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HanyadikHetVan.Data.Entities.WeeklyTimeSpan", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId");
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
|
@ -7,13 +7,20 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<PackageReference Include="AutoMapper.Collection" Version="7.0.1" />
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
|
||||
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="4.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.6">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.1.4" />
|
||||
|
19
HanyadikHetVan/Profiles/PauseProfile.cs
Normal file
19
HanyadikHetVan/Profiles/PauseProfile.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using AutoMapper;
|
||||
using HanyadikHetVan.Data.Entities;
|
||||
using HanyadikHetVan.DTO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Profiles
|
||||
{
|
||||
public class PauseProfile : Profile
|
||||
{
|
||||
public PauseProfile()
|
||||
{
|
||||
CreateMap<Pause, PauseDTO>();
|
||||
CreateMap<PauseDTO, Pause>().ForMember(x => x.Id, options => options.Ignore()).ForMember(x => x.WeeklyTimeSpanId, options => options.Ignore());
|
||||
}
|
||||
}
|
||||
}
|
15
HanyadikHetVan/Profiles/PurseProfile.cs
Normal file
15
HanyadikHetVan/Profiles/PurseProfile.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using AutoMapper;
|
||||
using HanyadikHetVan.Data.Entities;
|
||||
using HanyadikHetVan.DTO;
|
||||
|
||||
namespace HanyadikHetVan.Profiles
|
||||
{
|
||||
public class PurseProfile : Profile
|
||||
{
|
||||
public PurseProfile()
|
||||
{
|
||||
CreateMap<Purse, PurseDTO>();
|
||||
CreateMap<PurseDTO, Purse>().ForMember(x => x.User, options => options.Ignore()).ForMember(x => x.UserId, options => options.Ignore()).ForMember(x => x.Id, options => options.Ignore());
|
||||
}
|
||||
}
|
||||
}
|
19
HanyadikHetVan/Profiles/WeeklyTimeSpanProfile.cs
Normal file
19
HanyadikHetVan/Profiles/WeeklyTimeSpanProfile.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using AutoMapper;
|
||||
using HanyadikHetVan.Data.Entities;
|
||||
using HanyadikHetVan.DTO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Profiles
|
||||
{
|
||||
public class WeeklyTimeSpanProfile : Profile
|
||||
{
|
||||
public WeeklyTimeSpanProfile()
|
||||
{
|
||||
CreateMap<WeeklyTimeSpan, WeeklyTimeSpanDTO>();
|
||||
CreateMap<WeeklyTimeSpanDTO, WeeklyTimeSpan>().ForMember(x => x.Id, options => options.Ignore()).ForMember(x => x.Owner, options => options.Ignore()).ForMember(x => x.OwnerId, options => options.Ignore());
|
||||
}
|
||||
}
|
||||
}
|
37
HanyadikHetVan/Services/HanyadikHetVanEntityService.cs
Normal file
37
HanyadikHetVan/Services/HanyadikHetVanEntityService.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using AutoMapper;
|
||||
using HanyadikHetVan.Data;
|
||||
using HanyadikHetVan.Data.Entities;
|
||||
using HanyadikHetVan.DTO;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Services
|
||||
{
|
||||
public class HanyadikHetVanEntityService
|
||||
{
|
||||
private readonly ApplicationDbContext _dbContext;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public HanyadikHetVanEntityService(ApplicationDbContext dbContext, IMapper mapper)
|
||||
{
|
||||
_dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
|
||||
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
|
||||
}
|
||||
|
||||
public async Task<int> GetDefaultWeek()
|
||||
{
|
||||
var latest = await _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).LastAsync();
|
||||
var latestDto = _mapper.Map<WeeklyTimeSpan, WeeklyTimeSpanDTO>(latest);
|
||||
return latestDto.CurrentWeek;
|
||||
}
|
||||
|
||||
public async Task<int> GetWeekById(int weeklytimespanId)
|
||||
{
|
||||
var wts = await _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).Where(x => x.Id == weeklytimespanId).FirstOrDefaultAsync();
|
||||
var wtsDto = _mapper.Map<WeeklyTimeSpan, WeeklyTimeSpanDTO>(wts);
|
||||
return wtsDto.CurrentWeek;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
using HanyadikHetVan.Data;
|
||||
using AutoMapper;
|
||||
using HanyadikHetVan.Data;
|
||||
using HanyadikHetVan.Data.Entities;
|
||||
using HanyadikHetVan.DTO;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,31 +13,41 @@ namespace HanyadikHetVan.Services
|
||||
public class PauseService
|
||||
{
|
||||
private readonly ApplicationDbContext _dbContext;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public PauseService(ApplicationDbContext dbContext)
|
||||
public PauseService(ApplicationDbContext dbContext, IMapper mapper)
|
||||
{
|
||||
_dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
|
||||
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
|
||||
}
|
||||
|
||||
public IEnumerable<Pause> GetAllPauses()
|
||||
public async Task<List<PauseDTO>> GetAllPauses()
|
||||
{
|
||||
return _dbContext.Pauses.Include(x => x.WeeklyTimeSpan).ToList();
|
||||
var pauses = await _dbContext.Pauses.Include(x => x.WeeklyTimeSpan).ToListAsync();
|
||||
return _mapper.Map<List<Pause>, List<PauseDTO>>(pauses);
|
||||
}
|
||||
|
||||
public async Task<Pause> AddPause(Pause pause)
|
||||
public async Task<PauseDTO> AddPause(PauseDTO pause)
|
||||
{
|
||||
var obj = await _dbContext.Pauses.AddAsync(pause);
|
||||
_dbContext.SaveChanges();
|
||||
return obj.Entity;
|
||||
var pauseEntity = _mapper.Map<PauseDTO, Pause>(pause);
|
||||
var obj = _dbContext.Pauses.Add(pauseEntity);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return _mapper.Map<Pause, PauseDTO>(obj.Entity);
|
||||
}
|
||||
|
||||
public bool DeletePause(int pauseId)
|
||||
public async Task<PauseDTO> GetPause(int pauseId)
|
||||
{
|
||||
var pause = await _dbContext.Pauses.Where(x => x.Id == pauseId).FirstOrDefaultAsync();
|
||||
return _mapper.Map<Pause, PauseDTO>(pause);
|
||||
}
|
||||
|
||||
public async Task<bool> DeletePause(int pauseId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var item = _dbContext.Pauses.Where(x => x.Id == pauseId).FirstOrDefault();
|
||||
var item = await _dbContext.Pauses.Where(x => x.Id == pauseId).FirstOrDefaultAsync();
|
||||
_dbContext.Pauses.Remove(item);
|
||||
_dbContext.SaveChanges();
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
@ -44,22 +56,14 @@ namespace HanyadikHetVan.Services
|
||||
}
|
||||
}
|
||||
|
||||
public bool UpdatePause(Pause pause)
|
||||
public async Task<PauseDTO> UpdatePause(PauseDTO pause)
|
||||
{
|
||||
try
|
||||
{
|
||||
var DataList = _dbContext.Pauses.ToList();
|
||||
foreach (var item in DataList)
|
||||
{
|
||||
_dbContext.Pauses.Update(item);
|
||||
_dbContext.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
var pauseEntity = _mapper.Map<PauseDTO, Pause>(pause);
|
||||
pauseEntity.Id = pause.Id;
|
||||
_dbContext.Pauses.Update(pauseEntity);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
var newPause = await _dbContext.Pauses.Where(x => x.Id == pause.Id).FirstOrDefaultAsync();
|
||||
return _mapper.Map<Pause, PauseDTO>(newPause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
39
HanyadikHetVan/Services/PurseService.cs
Normal file
39
HanyadikHetVan/Services/PurseService.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using AutoMapper;
|
||||
using HanyadikHetVan.Data;
|
||||
using HanyadikHetVan.Data.Entities;
|
||||
using HanyadikHetVan.DTO;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Services
|
||||
{
|
||||
public class PurseService
|
||||
{
|
||||
private readonly ApplicationDbContext _dbContext;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public PurseService(ApplicationDbContext dbContext, IMapper mapper)
|
||||
{
|
||||
_dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
|
||||
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
|
||||
}
|
||||
|
||||
public async Task<PurseDTO> GetBalanceOfUser(String userId)
|
||||
{
|
||||
var purse = await _dbContext.Purses.Where(x => x.UserId == userId).FirstOrDefaultAsync();
|
||||
return _mapper.Map<Purse, PurseDTO>(purse);
|
||||
}
|
||||
|
||||
public async Task<PurseDTO> SetBalanceOfUser(String userId, int newBalance)
|
||||
{
|
||||
var purse = new Purse() { UserId = userId, Balance = newBalance };
|
||||
_dbContext.Purses.Update(purse);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
var newPurse = await _dbContext.Purses.Where(x => x.UserId == userId).FirstOrDefaultAsync();
|
||||
return _mapper.Map<Purse, PurseDTO>(newPurse);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
using HanyadikHetVan.Data;
|
||||
using AutoMapper;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
using HanyadikHetVan.Data;
|
||||
using HanyadikHetVan.Data.Entities;
|
||||
using HanyadikHetVan.DTO;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,46 +14,53 @@ namespace HanyadikHetVan.Services
|
||||
public class WeeklyTimeSpanService
|
||||
{
|
||||
private readonly ApplicationDbContext _dbContext;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public WeeklyTimeSpanService(ApplicationDbContext dbContext)
|
||||
public WeeklyTimeSpanService(ApplicationDbContext dbContext, IMapper mapper)
|
||||
{
|
||||
_dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
|
||||
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
|
||||
}
|
||||
|
||||
public IEnumerable<WeeklyTimeSpan> GetAllWeeklyTimeSpans()
|
||||
public async Task<List<WeeklyTimeSpanDTO>> GetAllWeeklyTimeSpans()
|
||||
{
|
||||
return _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).ToList();
|
||||
var wts = await _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).ToListAsync();
|
||||
return _mapper.Map<List<WeeklyTimeSpan>, List<WeeklyTimeSpanDTO>>(wts);
|
||||
}
|
||||
|
||||
public WeeklyTimeSpan GetWeeklyTimeSpan(int weeklytimespanId)
|
||||
public async Task<WeeklyTimeSpanDTO> GetWeeklyTimeSpan(int weeklytimespanId)
|
||||
{
|
||||
return _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).Where(x => x.Id == weeklytimespanId).FirstOrDefault();
|
||||
var wts = await _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).Where(x => x.Id == weeklytimespanId).FirstOrDefaultAsync();
|
||||
return _mapper.Map<WeeklyTimeSpan, WeeklyTimeSpanDTO>(wts);
|
||||
}
|
||||
|
||||
public ICollection<Pause> GetPausesOfWeeklyTimeSpan(int weeklytimespanId)
|
||||
public async Task<List<PauseDTO>> GetPausesOfWeeklyTimeSpan(int weeklytimespanId)
|
||||
{
|
||||
return _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).Where(x => x.Id == weeklytimespanId).FirstOrDefault().Pauses;
|
||||
var pauses = await _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).Where(x => x.Id == weeklytimespanId).FirstOrDefaultAsync();
|
||||
return _mapper.Map<ICollection<Pause>, List<PauseDTO>>(pauses.Pauses);
|
||||
}
|
||||
|
||||
public IEnumerable<WeeklyTimeSpan> GetWeeklyTimeSpanByStartdate(DateTime startTime)
|
||||
public async Task<WeeklyTimeSpanDTO> GetWeeklyTimeSpanByStartdate(DateTime startTime)
|
||||
{
|
||||
return _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).Where(x => x.Startdate.Date.Equals(startTime.Date)).ToList();
|
||||
var wts = await _dbContext.WeeklyTimeSpans.Include(x => x.Pauses).Where(x => x.Startdate.Date.Equals(startTime.Date)).ToListAsync();
|
||||
return _mapper.Map<List<WeeklyTimeSpan>, WeeklyTimeSpanDTO>(wts);
|
||||
}
|
||||
|
||||
public async Task<WeeklyTimeSpan> AddWeeklyTimeSpan(WeeklyTimeSpan weeklytimespan)
|
||||
public async Task<WeeklyTimeSpanDTO> AddWeeklyTimeSpan(WeeklyTimeSpanDTO weeklytimespan)
|
||||
{
|
||||
var obj = await _dbContext.WeeklyTimeSpans.AddAsync(weeklytimespan);
|
||||
_dbContext.SaveChanges();
|
||||
return obj.Entity;
|
||||
var wts = _mapper.Map<WeeklyTimeSpanDTO, WeeklyTimeSpan>(weeklytimespan);
|
||||
var obj = await _dbContext.WeeklyTimeSpans.AddAsync(wts);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return _mapper.Map<WeeklyTimeSpan, WeeklyTimeSpanDTO>(obj.Entity);
|
||||
}
|
||||
|
||||
public bool DeleteWeeklyTimeSpan(int weeklytimespanId)
|
||||
public async Task<bool> DeleteWeeklyTimeSpan(int weeklytimespanId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var item = _dbContext.WeeklyTimeSpans.Where(x => x.Id == weeklytimespanId).FirstOrDefault();
|
||||
var item = await _dbContext.WeeklyTimeSpans.Where(x => x.Id == weeklytimespanId).FirstOrDefaultAsync();
|
||||
_dbContext.WeeklyTimeSpans.Remove(item);
|
||||
_dbContext.SaveChanges();
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
@ -59,22 +69,14 @@ namespace HanyadikHetVan.Services
|
||||
}
|
||||
}
|
||||
|
||||
public bool UpdateWeeklyTimeSpan(WeeklyTimeSpan weeklytimespan)
|
||||
public async Task<WeeklyTimeSpanDTO> UpdateWeeklyTimeSpan(WeeklyTimeSpanDTO weeklytimespan)
|
||||
{
|
||||
try
|
||||
{
|
||||
var DataList = _dbContext.WeeklyTimeSpans.ToList();
|
||||
foreach (var item in DataList)
|
||||
{
|
||||
_dbContext.WeeklyTimeSpans.Update(item);
|
||||
_dbContext.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
var wts = _mapper.Map<WeeklyTimeSpanDTO, WeeklyTimeSpan>(weeklytimespan);
|
||||
wts.Id = weeklytimespan.Id;
|
||||
_dbContext.WeeklyTimeSpans.Update(wts);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
var newwts = await _dbContext.WeeklyTimeSpans.Where(x => x.Id == weeklytimespan.Id).FirstOrDefaultAsync();
|
||||
return _mapper.Map<WeeklyTimeSpan, WeeklyTimeSpanDTO>(newwts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System.Reflection;
|
||||
|
||||
namespace HanyadikHetVan
|
||||
{
|
||||
@ -21,14 +22,16 @@ namespace HanyadikHetVan
|
||||
|
||||
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.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseSqlServer(
|
||||
Configuration.GetConnectionString("DefaultConnection")));
|
||||
services.AddAutoMapper(Assembly.GetExecutingAssembly());
|
||||
services.AddTransient<WeeklyTimeSpanService>();
|
||||
services.AddTransient<PauseService>();
|
||||
services.AddTransient<PurseService>();
|
||||
services.AddTransient<HanyadikHetVanEntityService>();
|
||||
services.AddTransient<HanyadikHetVanJsonService>();
|
||||
services.AddTransient<HanyadikHetVanService>();
|
||||
services.AddDatabaseDeveloperPageExceptionFilter();
|
||||
@ -65,13 +68,24 @@ namespace HanyadikHetVan
|
||||
|
||||
services.AddControllers();
|
||||
|
||||
services.AddApiVersioning(options =>
|
||||
{
|
||||
options.ReportApiVersions = true;
|
||||
});
|
||||
|
||||
services.AddVersionedApiExplorer(options =>
|
||||
{
|
||||
options.GroupNameFormat = "'v'VVV";
|
||||
options.SubstituteApiVersionInUrl = true;
|
||||
});
|
||||
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Hanyadik Het Van API", Version = "v1" });
|
||||
c.SwaggerDoc("v2", new OpenApiInfo { Title = "Hanyadik Het Van API", Version = "v2" });
|
||||
});
|
||||
}
|
||||
|
||||
// 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())
|
||||
@ -79,7 +93,11 @@ namespace HanyadikHetVan
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseMigrationsEndPoint();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("v1/swagger.json", "HanyadikHetVan v1"));
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("v1/swagger.json", "Original API");
|
||||
c.SwaggerEndpoint("v2/swagger.json", "Homework API");
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
1
Insomnia.json
Normal file
1
Insomnia.json
Normal file
@ -0,0 +1 @@
|
||||
{"_type":"export","__export_format":4,"__export_date":"2021-05-18T17:38:15.292Z","__export_source":"insomnia.desktop.app:v2021.3.0","resources":[{"_id":"req_d1ce12920703411bb9239086d5eebeaf","parentId":"wrk_f357700b92cd436684cbaa092faddb11","modified":1621358836406,"created":1621358764056,"url":"","name":"Login","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"CLIENT_ID","value":"postman","description":"","id":"pair_15ae3c2fcba54b498cb7a0472a300c03"},{"name":"CLIENT_SECRET","value":"xmYYS/lSPIz5IdbgUXNbp66JYSejHbw7/oFXy7CLk8s=","description":"","id":"pair_792b4774ecc74d1fa6668b34b007966f"},{"name":"","value":"","description":"","id":"pair_02f1429d1c7b4742a50026136ccfb60c"}],"authentication":{},"metaSortKey":-1621358764056,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"wrk_f357700b92cd436684cbaa092faddb11","parentId":null,"modified":1621358491167,"created":1621358491167,"name":"HanyadikHetVan","description":"","scope":"collection","_type":"workspace"},{"_id":"req_87fc2e4796ae4fada37c7669d5b03209","parentId":"wrk_f357700b92cd436684cbaa092faddb11","modified":1621358697962,"created":1621358525104,"url":"https://127.0.0.1:5001/api/test/unprotected","name":"Test Unprotected","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1621358525104,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_deaaea3ec86b436398e5a0bb91547ed6","parentId":"wrk_f357700b92cd436684cbaa092faddb11","modified":1621359446725,"created":1621358708070,"url":"https://127.0.0.1:5001/api/test/protected","name":"Test Protected","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{"type":"oauth2","grantType":"password","clientId":"postman","clientSecret":"cunci","scope":"openid profile user_role api.readwrite","accessTokenUrl":"https://localhost:5001/connect/token","password":"Asdfghjkl0.","username":"valami@valami.com","credentialsInBody":true},"metaSortKey":-1621358525054,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_3678daf1d98efdcce76cc3814492161dfc393bd6","parentId":"wrk_f357700b92cd436684cbaa092faddb11","modified":1621358492714,"created":1621358492714,"name":"Base Environment","data":{},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1621358492715,"_type":"environment"},{"_id":"jar_3678daf1d98efdcce76cc3814492161dfc393bd6","parentId":"wrk_f357700b92cd436684cbaa092faddb11","modified":1621358492771,"created":1621358492771,"name":"Default Jar","cookies":[],"_type":"cookie_jar"},{"_id":"spc_602f99b584af4a05a041b16758dfd954","parentId":"wrk_f357700b92cd436684cbaa092faddb11","modified":1621358491227,"created":1621358491227,"fileName":"HanyadikHetVan","contents":"","contentType":"yaml","_type":"api_spec"}]}
|
Loading…
Reference in New Issue
Block a user