public async Task <int> AddATeamPrinciple(TeamPrinciple teamPrinciple) { var sql = @"INSERT INTO [dbo].TeamPrinciple (FirstName, LastName, Nationality, DOB, EntryDate, LeaveDate) VALUES (@FirstName, @LastName, @Nationality, @DOB, @EntryDate, @LeaveDate) SELECT CAST (SCOPE_IDENTITY() as int);"; using (var conn = _connectionProvider.Get()) { return(await conn.ExecuteScalarAsync <int>(sql, teamPrinciple)); } }
public async Task <ActionResult <TeamPrinciple> > GetTeamPrincipleById(int id) { var result = await _dataReader.GetTeamPrincipleById(id); return(TeamPrinciple.MapFromDb(result)); }
public async Task <ActionResult <List <TeamPrinciple> > > GetAllTeamPrinciples() { var result = await _dataReader.GetAllTeamPrinciples(); return(result.Select(x => TeamPrinciple.MapFromDb(x)).ToList()); }