add missing fields
This commit is contained in:
@@ -8,6 +8,7 @@ using weddingapi.Repositories;
|
||||
using weddingapi.Dtos;
|
||||
using weddingapi.Converters;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
|
||||
namespace weddingapi.Controllers
|
||||
{
|
||||
@@ -22,6 +23,15 @@ namespace weddingapi.Controllers
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
// GET /familyCount
|
||||
[HttpGet("FamilyCount")]
|
||||
public async Task<int> GetFamilyCountAsync()
|
||||
{
|
||||
int totalCount = 0;
|
||||
(await repository.GetFamiliesAsync()).ToList().ForEach(family => totalCount += family.Members.Count());
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
// GET /family
|
||||
[HttpGet]
|
||||
public async Task<IEnumerable<FamilyDto>> GetFamiliesAsync()
|
||||
@@ -55,6 +65,8 @@ namespace weddingapi.Controllers
|
||||
CreatedDate = DateTimeOffset.UtcNow,
|
||||
Name = familyDto.Name,
|
||||
Overnight = familyDto.Overnight,
|
||||
Email = familyDto.EMail,
|
||||
Telephonenumber = familyDto.Telephonenumber,
|
||||
Members = familyDto.Members.Select(person => new Person() {
|
||||
IsChild = person.IsChild,
|
||||
Name = person.Name,
|
||||
@@ -84,6 +96,8 @@ namespace weddingapi.Controllers
|
||||
IsChild = person.IsChild,
|
||||
}).ToList(),
|
||||
Overnight = familyDto.Overnight,
|
||||
Email = familyDto.Email,
|
||||
Telephonenumber = familyDto.Telephonenumber,
|
||||
Name = familyDto.Name,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user