Reference the project to the newly created db context

This commit is contained in:
Jeff Leung 2021-12-28 19:41:05 -08:00
parent 7cd388c85b
commit 41cecd32a0
10 changed files with 18 additions and 58 deletions

View File

@ -7,7 +7,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using TwilioSMSReceiver; using TwilioSMSReceiver;
using TwilioSMSReceiver.Models; using TwilioSMSReceiver.Data;
using TwilioSMSReceiver.Data.Models;
namespace TwilioSMSReceiver.Controllers namespace TwilioSMSReceiver.Controllers
{ {

View File

@ -8,8 +8,9 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Twilio.AspNet.Common; using Twilio.AspNet.Common;
using TwilioSMSReceiver; using TwilioSMSReceiver;
using TwilioSMSReceiver.Data;
using TwilioSMSReceiver.Data.Models;
using TwilioSMSReceiver.Interfaces; using TwilioSMSReceiver.Interfaces;
using TwilioSMSReceiver.Models;
namespace TwilioSMSReceiver.Controllers namespace TwilioSMSReceiver.Controllers
{ {

View File

@ -1,5 +1,6 @@
#nullable disable #nullable disable
using TwilioSMSReceiver.Models; using TwilioSMSReceiver.Data;
using TwilioSMSReceiver.Data.Models;
namespace TwilioSMSReceiver.Interfaces namespace TwilioSMSReceiver.Interfaces
{ {

View File

@ -1,4 +1,4 @@
using TwilioSMSReceiver.Models; using TwilioSMSReceiver.Data.Models;
namespace TwilioSMSReceiver.Interfaces namespace TwilioSMSReceiver.Interfaces
{ {

View File

@ -1,4 +1,4 @@
using TwilioSMSReceiver.Models; using TwilioSMSReceiver.Data.Models;
using TeamsHook.NET; using TeamsHook.NET;
namespace TwilioSMSReceiver.Interfaces namespace TwilioSMSReceiver.Interfaces

View File

@ -1,4 +1,4 @@
using TwilioSMSReceiver.Models; using TwilioSMSReceiver.Data.Models;
namespace TwilioSMSReceiver.Interfaces namespace TwilioSMSReceiver.Interfaces
{ {

View File

@ -1,36 +0,0 @@
#nullable disable
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
namespace TwilioSMSReceiver.Models
{
public class SMSModel
{
[Key]
public int Id { get; set; }
[Required]
public string ReceivedNumber { get; set; }
[Required]
public string SenderNumber { get; set; }
public DateTime TimeReceived { get; set; }
public string? MessageContents { get; set; }
public ICollection<MMSModel> MMSContent { get; set; }
public bool IsForwardedYet { get; set; }
}
public class MMSModel
{
[Key]
public int Id { get; set; }
public int SMSModelId { get; set; }
public SMSModel ParentSMSMessage { get; set; }
public string OriginalMMSData { get; set; }
}
public class MSTeamsWebHook
{
public int Id { get; set; }
public string WebHookUri { get; set; }
}
}

View File

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using TwilioSMSReceiver; using TwilioSMSReceiver;
using TwilioSMSReceiver.Interfaces; using TwilioSMSReceiver.Interfaces;
using TwilioSMSReceiver.Data;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);

View File

@ -1,16 +0,0 @@
using Microsoft.EntityFrameworkCore;
using TwilioSMSReceiver.Models;
namespace TwilioSMSReceiver
{
public class SMSDbCtx : DbContext
{
public SMSDbCtx(DbContextOptions options) : base(options)
{
}
public DbSet<SMSModel> SMSMessages { get;set; }
public DbSet<MMSModel> MMSMessages { get;set; }
public DbSet<MSTeamsWebHook> MSTeamsWebHooks { get;set; }
}
}

View File

@ -24,4 +24,12 @@
<PackageReference Include="Twilio.AspNet.Common" Version="5.68.3" /> <PackageReference Include="Twilio.AspNet.Common" Version="5.68.3" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TwilioSMSReceiver.Data\TwilioSMSReceiver.Data.csproj" />
</ItemGroup>
</Project> </Project>