all property names in UpperCamelCase

This commit is contained in:
Jakob Fahr
2020-07-08 18:10:58 +02:00
parent faafbbeb62
commit 2c7f8dbe84
8 changed files with 164 additions and 165 deletions

View File

@@ -1,48 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace ScrumTaskboard.Controllers
{
[Route("[controller]")]
[ApiController]
public class SprintsController : ControllerBase
{
private readonly TaskContext _context;
public SprintsController(TaskContext context)
{
_context = context;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace ScrumTaskboard.Controllers
{
[Route("[controller]")]
[ApiController]
public class SprintsController : ControllerBase
{
private readonly TaskContext _context;
public SprintsController(TaskContext context)
{
_context = context;
}
// GET: api/sprint
#nullable enable
[HttpGet]
public async Task<ActionResult<IEnumerable<ScrumSprint>>> GetSprint([FromQuery]string? title, [FromQuery]int? projectid, [FromQuery]DateTime? startDate, [FromQuery]DateTime? endDate)
{
var filtered = _context.Sprints.AsQueryable();
if (title != null)
{
filtered = filtered.Where<ScrumSprint>(s => s.title.Contains(title));
}
if (projectid != null)
{
filtered = filtered.Where<ScrumSprint>(s => s.projectid == projectid);
}
#nullable enable
[HttpGet]
public async Task<ActionResult<IEnumerable<ScrumSprint>>> GetSprint([FromQuery]string? title, [FromQuery]int? projectid, [FromQuery]DateTime? startDate, [FromQuery]DateTime? endDate)
{
var filtered = _context.Sprints.AsQueryable();
if (title != null)
{
filtered = filtered.Where<ScrumSprint>(s => s.Title.Contains(title));
}
if (projectid != null)
{
filtered = filtered.Where<ScrumSprint>(s => s.ProjectId == projectid);
}
if (startDate != null)
{
filtered = filtered.Where<ScrumSprint>(s => s.startDate == startDate);
filtered = filtered.Where<ScrumSprint>(s => s.StartDate == startDate);
}
if (endDate != null)
{
filtered = filtered.Where<ScrumSprint>(s => s.endDate == endDate);
}
return await filtered.ToListAsync();
{
filtered = filtered.Where<ScrumSprint>(s => s.EndDate == endDate);
}
return await filtered.ToListAsync();
}
#nullable disable
@@ -50,14 +50,14 @@ namespace ScrumTaskboard.Controllers
[HttpGet("{id}")]
public async Task<ActionResult<ScrumSprint>> GetSprint(int id)
{
var Sprint = await _context.Sprints.FindAsync(id);
var sprint = await _context.Sprints.FindAsync(id);
if (Sprint == null)
if (sprint == null)
{
return NotFound();
}
return Sprint;
return sprint;
}
// PUT: api/sprint/5
@@ -65,7 +65,7 @@ namespace ScrumTaskboard.Controllers
public async Task<IActionResult> PutSprint(int id, ScrumSprint sprint)
{
// Die ID des Sprints darf nicht geändert werden
if (id != sprint.id)
if (id != sprint.Id)
{
return BadRequest();
}
@@ -102,7 +102,7 @@ namespace ScrumTaskboard.Controllers
await _context.SaveChangesAsync();
// Der neue Sprint wurde erstellt und kann über die GetSprint Methode abgerufen werden.
return CreatedAtAction("GetSprint", new { id = sprint.id }, sprint);
return CreatedAtAction("GetSprint", new { id = sprint.Id }, sprint);
}
// DELETE: api/Sprint/5
@@ -123,12 +123,12 @@ namespace ScrumTaskboard.Controllers
return scrumSprint;
}
/// <summary>
/// Prüft, ob ein Sprint mit der angegebenen ID bereits existiert.
/// </summary>
/// <summary>
/// Prüft, ob ein Sprint mit der angegebenen ID bereits existiert.
/// </summary>
private bool SprintExists(int id)
{
return _context.Sprints.Any(e => e.id == id);
return _context.Sprints.Any(e => e.Id == id);
}
}
}
}
}