Subscription design completed
This commit is contained in:
parent
2ebe7ad5b3
commit
2a383d0c3d
26 changed files with 1423 additions and 35 deletions
|
|
@ -32,6 +32,8 @@ namespace Data
|
|||
public DbSet<Question> Questions { get; set; }
|
||||
public DbSet<Answer> Answers { get; set; }
|
||||
|
||||
public DbSet<Subscription> Subscriptions { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
22
Model/Subscription.cs
Normal file
22
Model/Subscription.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class Subscription
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string? Email { get; set; }
|
||||
|
||||
public bool IsSubscribed { get; set; }
|
||||
}
|
||||
}
|
||||
22
Services/EmailSend/EmailToSend.cs
Normal file
22
Services/EmailSend/EmailToSend.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Services.EmailSend
|
||||
{
|
||||
public class EmailToSend
|
||||
{
|
||||
public EmailToSend(string to, string subject, string body)
|
||||
{
|
||||
To = to;
|
||||
Subject = subject;
|
||||
Body = body;
|
||||
}
|
||||
|
||||
public string To { get; set; }
|
||||
public string Subject { get; set; }
|
||||
public string Body { get; set; }
|
||||
}
|
||||
}
|
||||
53
Services/Implemnetation/EmailServices.cs
Normal file
53
Services/Implemnetation/EmailServices.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using Mailjet.Client;
|
||||
using Mailjet.Client.Resources;
|
||||
using Mailjet.Client.TransactionalEmails;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Services.EmailSend;
|
||||
using Services.Interaces;
|
||||
|
||||
|
||||
namespace Services.Implemnetation
|
||||
{
|
||||
public class EmailServices : IEmailServices
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public EmailServices(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
public async Task<bool> SendConfirmationEmailAsync(EmailToSend emailSend)
|
||||
{
|
||||
|
||||
|
||||
|
||||
MailjetClient client = new MailjetClient(_configuration["MailJet:ApiKey"], _configuration["MailJet:SecretKey"]);
|
||||
|
||||
var email = new TransactionalEmailBuilder()
|
||||
.WithFrom(new SendContact(_configuration["Email:From"], _configuration["Email:ApplicationName"]))
|
||||
.WithSubject(emailSend.Subject)
|
||||
.WithHtmlPart(emailSend.Body)
|
||||
.WithTo(new SendContact(emailSend.To))
|
||||
.Build();
|
||||
|
||||
|
||||
var response = await client.SendTransactionalEmailAsync(email);
|
||||
|
||||
if (response.Messages != null)
|
||||
{
|
||||
if (response.Messages[0].Status == "success")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
15
Services/Interaces/IEmailServices.cs
Normal file
15
Services/Interaces/IEmailServices.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Services.EmailSend;
|
||||
|
||||
|
||||
namespace Services.Interaces
|
||||
{
|
||||
public interface IEmailServices
|
||||
{
|
||||
Task<bool> SendConfirmationEmailAsync(EmailToSend emailSend);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,11 +7,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!--<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.3.0" />-->
|
||||
<!--<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />-->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailJet.Api" Version="3.0.0" />
|
||||
<ProjectReference Include="..\Data\Data.csproj" />
|
||||
<ProjectReference Include="..\Model\Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -216,19 +216,59 @@ namespace Web.Areas.Admin.Controllers
|
|||
.Where(sm => selectedSocialMediaIds.Contains(sm.Id))
|
||||
.ToList();
|
||||
|
||||
var existingSocialMediaIds = footer.FooterSocialMedias.Select(fsm => fsm.SocialId).ToList();
|
||||
|
||||
// Find the IDs of social media that are no longer selected
|
||||
var removedSocialMediaIds = existingSocialMediaIds.Except(selectedSocialMediaIds).ToList();
|
||||
|
||||
// Remove associations for the removed social media
|
||||
foreach (var removedSocialMediaId in removedSocialMediaIds)
|
||||
{
|
||||
var removedAssociation = footer.FooterSocialMedias.FirstOrDefault(fsm => fsm.SocialId == removedSocialMediaId);
|
||||
if (removedAssociation != null)
|
||||
{
|
||||
footer.FooterSocialMedias.Remove(removedAssociation);
|
||||
|
||||
|
||||
}
|
||||
_footer.Update(footer);
|
||||
await _footer.commitAsync();
|
||||
}
|
||||
|
||||
foreach (var socialMedia in selectedSocialMedias)
|
||||
{
|
||||
// Check if a FooterSocialMedia with the same key values already exists in the context
|
||||
var existingFooterSocialMedia = footer.FooterSocialMedias.FirstOrDefault(fsm => fsm.SocialId == socialMedia.Id);
|
||||
|
||||
footer.FooterSocialMedias.Add(new FooterSocialMedia
|
||||
if (existingFooterSocialMedia != null)
|
||||
{
|
||||
SocialId = socialMedia.Id
|
||||
// Add other properties as needed
|
||||
});
|
||||
// Update properties of existing entity
|
||||
existingFooterSocialMedia.SocialMedia.Name = socialMedia.Name;
|
||||
// Update other properties as needed
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add new entity to the context
|
||||
footer.FooterSocialMedias.Add(new FooterSocialMedia
|
||||
{
|
||||
SocialId = socialMedia.Id
|
||||
// Add other properties as needed
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//foreach (var socialMedia in selectedSocialMedias)
|
||||
//{
|
||||
|
||||
// footer.FooterSocialMedias.Add(new FooterSocialMedia
|
||||
// {
|
||||
// SocialId = socialMedia.Id
|
||||
// // Add other properties as needed
|
||||
// });
|
||||
//}
|
||||
|
||||
|
||||
_footer.Update(footer);
|
||||
await _footer.commitAsync();
|
||||
TempData["Success"] = "Footer updated successfully";
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@
|
|||
|
||||
|
||||
<main class=" mt-5">
|
||||
|
||||
@RenderBody()
|
||||
</main>
|
||||
|
||||
|
|
|
|||
164
Web/Controllers/SubscriptionController.cs
Normal file
164
Web/Controllers/SubscriptionController.cs
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
using Data;
|
||||
using Mailjet.Client;
|
||||
using Mailjet.Client.Resources;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Model;
|
||||
using Services.Implemnetation;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Services.Interaces;
|
||||
using Services.EmailSend;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
||||
namespace Web.Controllers
|
||||
{
|
||||
public class SubscriptionController : Controller
|
||||
{
|
||||
private readonly SurveyContext _context;
|
||||
private readonly IEmailServices _mailSerivces;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public SubscriptionController(SurveyContext context,IEmailServices mailSerivces,IConfiguration configuration)
|
||||
{
|
||||
_context = context;
|
||||
_mailSerivces = mailSerivces;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
// GET: /Subscription/Subscribe
|
||||
public IActionResult Subscribe()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: /Subscription/Subscribe
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Subscribe(Subscription subscription)
|
||||
{
|
||||
|
||||
if(ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
string email = subscription.Email;
|
||||
string senderName = email.Substring(0, email.IndexOf('@')).ToUpper();
|
||||
|
||||
// Check if the email already exists
|
||||
var existingSubscription = await _context.Subscriptions.FirstOrDefaultAsync(s => s.Email == email);
|
||||
if (existingSubscription != null)
|
||||
{
|
||||
|
||||
TempData["error"] = "Email already exists.";
|
||||
return RedirectToAction("", "home");
|
||||
}
|
||||
|
||||
string subject = "Subscription Confirmation";
|
||||
string confirmationPath = _configuration["Email:ConfirmEmailPath"]; // Retrieve the confirmation path from appsettings
|
||||
|
||||
string confirmationUrl = $"{Request.Scheme}://{Request.Host}/{confirmationPath}?email={email}"; // Construct the confirmation URL
|
||||
// Construct the confirmation URL
|
||||
string body = $@"Dear {senderName},<br><br>
|
||||
Thank you for subscribing. We're thrilled to have you on board!<br><br>
|
||||
To confirm your subscription, please click the following button:<br><br>
|
||||
<a href=""{confirmationUrl}"" style=""display: inline-block; padding: 10px 20px; background-color: #28a745; color: #fff; text-decoration: none;"">Confirm Subscription</a><br><br>
|
||||
If you have any questions or need assistance, feel free to contact us at help@seosoft.dk<br><br>
|
||||
Best regards,<br>
|
||||
<h5>
|
||||
Søren Eggert Lundsteen Olsen<br>
|
||||
Seosoft ApS
|
||||
</h5>
|
||||
";
|
||||
|
||||
var newEmail = new EmailToSend(email, subject, body);
|
||||
|
||||
await _mailSerivces.SendConfirmationEmailAsync(newEmail);
|
||||
|
||||
var subscriber = new Subscription
|
||||
{
|
||||
Name = senderName,
|
||||
Email = subscription.Email,
|
||||
IsSubscribed = false
|
||||
};
|
||||
|
||||
_context.Subscriptions.Add(subscriber);
|
||||
await _context.SaveChangesAsync();
|
||||
TempData["success"] = "Subscription successful.";
|
||||
return RedirectToAction("", "home");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TempData["error"] = "Failed to subscribe.";
|
||||
return RedirectToAction("", "home");
|
||||
}
|
||||
}
|
||||
|
||||
return RedirectToAction("", "home");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//private async Task SendConfirmationEmail(Subscription subscriber)
|
||||
//{
|
||||
// var confirmationLink = Url.Action("Unsubscribe", "Subscription", new { id = subscriber.Id }, protocol: HttpContext.Request.Scheme);
|
||||
|
||||
// var request = new MailjetRequest
|
||||
// {
|
||||
// Resource = Send.Resource,
|
||||
// }
|
||||
// .Property(Send.Messages, new JArray
|
||||
// {
|
||||
// new JObject
|
||||
// {
|
||||
// {
|
||||
// "From",
|
||||
// new JObject
|
||||
// {
|
||||
// {"Email", "qais@seosoft.dk"},
|
||||
// {"Name", "SeoSoft"}
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "To",
|
||||
// new JArray
|
||||
// {
|
||||
// new JObject
|
||||
// {
|
||||
// {"Email", subscriber.Email},
|
||||
// {"Name", subscriber.Name}
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {"Subject", "Subscription Confirmation"},
|
||||
// {"HTMLPart", $@"<p>Hello {subscriber.Name},</p>
|
||||
// <p>Thank you for subscribing!</p>
|
||||
// <p>To unsubscribe, click <a href='{confirmationLink}'>here</a>.</p>"
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// try
|
||||
// {
|
||||
// var response = await _mailjetClient.PostAsync(request);
|
||||
// if (!response.IsSuccessStatusCode)
|
||||
// {
|
||||
// // Handle error if sending email fails
|
||||
// // For example, log the error or take appropriate action
|
||||
// // You can throw an exception if needed
|
||||
// throw new Exception("Failed to send confirmation email");
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// // Log the exception or take appropriate action
|
||||
// // For example:
|
||||
// // _logger.LogError(ex, "Failed to send confirmation email");
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
using Data;
|
||||
using Mailjet.Client;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Services.Implemnetation;
|
||||
using Services.Interaces;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Web.Extesions
|
||||
{
|
||||
|
|
@ -48,5 +50,37 @@ namespace Web.Extesions
|
|||
{
|
||||
services.AddScoped<IQuestionRepository, QuestionRepository>();
|
||||
}
|
||||
public static void MailConfiguration(this IServiceCollection services)
|
||||
{
|
||||
services.AddTransient<IEmailServices, EmailServices>();
|
||||
}
|
||||
|
||||
//public static void MailConfiguration(this IServiceCollection services, IConfiguration configuration)
|
||||
//{
|
||||
// services.AddControllersWithViews();
|
||||
|
||||
// services.AddScoped<IMailjetClient>(s =>
|
||||
// {
|
||||
// var apiKey = configuration.GetSection("Mailjet")["ApiKey"];
|
||||
// var apiSecret = configuration.GetSection("Mailjet")["SecretKey"];
|
||||
// return new MailjetClient(apiKey, apiSecret);
|
||||
// });
|
||||
|
||||
//}
|
||||
|
||||
public static void ConfigureServicesMailJet(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
// Other configurations...
|
||||
|
||||
// Retrieve Mailjet settings from appsettings.json
|
||||
var mailjetSettings = configuration.GetSection("MailJet");
|
||||
var apiKey = mailjetSettings["ApiKey"];
|
||||
var apiSecret = mailjetSettings["SecretKey"];
|
||||
|
||||
// Register Mailjet service with API key and secret key
|
||||
//services.AddSingleton<IMailjetService>(new MailjetService(apiKey, apiSecret));
|
||||
|
||||
// Other configurations...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
392
Web/Migrations/20240401115718_SubscriptionModelAdded.Designer.cs
generated
Normal file
392
Web/Migrations/20240401115718_SubscriptionModelAdded.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,392 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Web.Migrations
|
||||
{
|
||||
[DbContext(typeof(SurveyContext))]
|
||||
[Migration("20240401115718_SubscriptionModelAdded")]
|
||||
partial class SubscriptionModelAdded
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Model.Address", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CVR")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("City")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Country")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Mobile")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PostalCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Street")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Addresss");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Answer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("QuestionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("QuestionId");
|
||||
|
||||
b.ToTable("Answers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Banner", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImageUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LinkUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Banners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Footer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImageUlr")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("LastUpdated")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Sitecopyright")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UpdatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Footers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.FooterSocialMedia", b =>
|
||||
{
|
||||
b.Property<int>("FooterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SocialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("FooterId", "SocialId");
|
||||
|
||||
b.HasIndex("SocialId");
|
||||
|
||||
b.ToTable("FooterSocialMedias");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Page", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BannerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("FooterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BannerId");
|
||||
|
||||
b.HasIndex("FooterId");
|
||||
|
||||
b.ToTable("Pages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Question", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("QuestionnaireId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("QuestionnaireId");
|
||||
|
||||
b.ToTable("Questions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Questionnaire", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Questionnaires");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.SocialMedia", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SocialMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsSubscribed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Answer", b =>
|
||||
{
|
||||
b.HasOne("Model.Question", "Question")
|
||||
.WithMany("Answers")
|
||||
.HasForeignKey("QuestionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.FooterSocialMedia", b =>
|
||||
{
|
||||
b.HasOne("Model.Footer", "Footer")
|
||||
.WithMany("FooterSocialMedias")
|
||||
.HasForeignKey("FooterId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Model.SocialMedia", "SocialMedia")
|
||||
.WithMany("FooterSocialMedias")
|
||||
.HasForeignKey("SocialId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Footer");
|
||||
|
||||
b.Navigation("SocialMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Page", b =>
|
||||
{
|
||||
b.HasOne("Model.Banner", "banner")
|
||||
.WithMany()
|
||||
.HasForeignKey("BannerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Model.Footer", "footer")
|
||||
.WithMany()
|
||||
.HasForeignKey("FooterId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("banner");
|
||||
|
||||
b.Navigation("footer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Question", b =>
|
||||
{
|
||||
b.HasOne("Model.Questionnaire", "Questionnaire")
|
||||
.WithMany("Questions")
|
||||
.HasForeignKey("QuestionnaireId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Questionnaire");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Footer", b =>
|
||||
{
|
||||
b.Navigation("FooterSocialMedias");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Question", b =>
|
||||
{
|
||||
b.Navigation("Answers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Questionnaire", b =>
|
||||
{
|
||||
b.Navigation("Questions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.SocialMedia", b =>
|
||||
{
|
||||
b.Navigation("FooterSocialMedias");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Web/Migrations/20240401115718_SubscriptionModelAdded.cs
Normal file
36
Web/Migrations/20240401115718_SubscriptionModelAdded.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Web.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SubscriptionModelAdded : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Subscriptions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
IsSubscribed = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Subscriptions", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Subscriptions");
|
||||
}
|
||||
}
|
||||
}
|
||||
391
Web/Migrations/20240403083337_RequriedfiledRemoved.Designer.cs
generated
Normal file
391
Web/Migrations/20240403083337_RequriedfiledRemoved.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,391 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Web.Migrations
|
||||
{
|
||||
[DbContext(typeof(SurveyContext))]
|
||||
[Migration("20240403083337_RequriedfiledRemoved")]
|
||||
partial class RequriedfiledRemoved
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Model.Address", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CVR")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("City")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Country")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Mobile")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PostalCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Street")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Addresss");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Answer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("QuestionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("QuestionId");
|
||||
|
||||
b.ToTable("Answers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Banner", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImageUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LinkUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Banners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Footer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImageUlr")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("LastUpdated")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Sitecopyright")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UpdatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Footers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.FooterSocialMedia", b =>
|
||||
{
|
||||
b.Property<int>("FooterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SocialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("FooterId", "SocialId");
|
||||
|
||||
b.HasIndex("SocialId");
|
||||
|
||||
b.ToTable("FooterSocialMedias");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Page", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BannerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("FooterId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BannerId");
|
||||
|
||||
b.HasIndex("FooterId");
|
||||
|
||||
b.ToTable("Pages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Question", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("QuestionnaireId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("QuestionnaireId");
|
||||
|
||||
b.ToTable("Questions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Questionnaire", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Questionnaires");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.SocialMedia", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SocialMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsSubscribed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Answer", b =>
|
||||
{
|
||||
b.HasOne("Model.Question", "Question")
|
||||
.WithMany("Answers")
|
||||
.HasForeignKey("QuestionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.FooterSocialMedia", b =>
|
||||
{
|
||||
b.HasOne("Model.Footer", "Footer")
|
||||
.WithMany("FooterSocialMedias")
|
||||
.HasForeignKey("FooterId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Model.SocialMedia", "SocialMedia")
|
||||
.WithMany("FooterSocialMedias")
|
||||
.HasForeignKey("SocialId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Footer");
|
||||
|
||||
b.Navigation("SocialMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Page", b =>
|
||||
{
|
||||
b.HasOne("Model.Banner", "banner")
|
||||
.WithMany()
|
||||
.HasForeignKey("BannerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Model.Footer", "footer")
|
||||
.WithMany()
|
||||
.HasForeignKey("FooterId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("banner");
|
||||
|
||||
b.Navigation("footer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Question", b =>
|
||||
{
|
||||
b.HasOne("Model.Questionnaire", "Questionnaire")
|
||||
.WithMany("Questions")
|
||||
.HasForeignKey("QuestionnaireId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Questionnaire");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Footer", b =>
|
||||
{
|
||||
b.Navigation("FooterSocialMedias");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Question", b =>
|
||||
{
|
||||
b.Navigation("Answers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Questionnaire", b =>
|
||||
{
|
||||
b.Navigation("Questions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.SocialMedia", b =>
|
||||
{
|
||||
b.Navigation("FooterSocialMedias");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Web/Migrations/20240403083337_RequriedfiledRemoved.cs
Normal file
36
Web/Migrations/20240403083337_RequriedfiledRemoved.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Web.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RequriedfiledRemoved : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "Subscriptions",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "Subscriptions",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -280,6 +280,29 @@ namespace Web.Migrations
|
|||
b.ToTable("SocialMedia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsSubscribed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Answer", b =>
|
||||
{
|
||||
b.HasOne("Model.Question", "Question")
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ builder.Services.ConfigureQuestionnarie();
|
|||
builder.Services.ConfigureQuestion();
|
||||
builder.Services.AddScoped<SurveyContext>();
|
||||
builder.Services.AddTransient<NavigationViewComponent>();
|
||||
builder.Services.MailConfiguration();
|
||||
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
|
|
|||
14
Web/ViewComponents/SubscriptionViewComponent.cs
Normal file
14
Web/ViewComponents/SubscriptionViewComponent.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Model;
|
||||
|
||||
namespace Web.ViewComponents
|
||||
{
|
||||
public class SubscriptionViewComponent:ViewComponent
|
||||
{
|
||||
public IViewComponentResult Invoke()
|
||||
{
|
||||
var subscriber = new Subscription(); // Instantiate a new Subscriber model
|
||||
return View(subscriber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
|
||||
<!-- FOR DEMO PURPOSE -->
|
||||
<section id="MainContent" class="hero text-white">
|
||||
<section id="MainContent" class="text-white">
|
||||
<div class="container py-1">
|
||||
@* <div class="col-12" id="boxBanner">
|
||||
<h1 class="display-6 text-white font-weight-bold">@Model.Description.ToUpper()</h1>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
@* <p class="fst-italic text-muted">@Html.Raw(Model.Content) <a class="text-primary" href="@Model.Sitecopyright" target="_blank">SeoSoft</a></p> *@
|
||||
<p class="text-white">@Html.Raw(Model.Content)</p>
|
||||
<a href="#" class="btn mt-1" id="HomeButon"> Contact <i class="bi bi-ui-checks"></i></a>
|
||||
<a href="#" class="btn btn-sm mt-1" id="HomeButon"> Contact</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
@ -33,3 +33,10 @@
|
|||
|
||||
|
||||
|
||||
@section Scripts {
|
||||
|
||||
|
||||
@{
|
||||
<partial name="_ValidationScriptsPartial" />
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
@* <p class="fst-italic text-muted">@Html.Raw(Model.Content) <a class="text-primary" href="@Model.Sitecopyright" target="_blank">SeoSoft</a></p> *@
|
||||
<p class="text-white">@Html.Raw(Model.Content)</p>
|
||||
<a href="@Model.LinkUrl" class="btn mt-1" id="BannerButon"> Contact <i class="bi bi-ui-checks"></i></a>
|
||||
<a href="@Model.LinkUrl" class="btn btn-sm mt-1" id="BannerButon"> Contact <i class="bi bi-ui-checks"></i></a>
|
||||
</div>
|
||||
<div class="col-lg-6" id="boxBanner">
|
||||
<script src="https://unpkg.com/@@dotlottie/player-component@latest/dist/dotlottie-player.mjs" type="module"></script>
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
<div class="d-flex flex-column" id="Background">
|
||||
|
||||
<!-- FOR DEMO PURPOSE -->
|
||||
<section class="hero text-white flex-grow-1">
|
||||
<section class="text-white flex-grow-1">
|
||||
<div class="container py-4">
|
||||
<div id="rowSection">
|
||||
<div class="col-lg-6" id="box">
|
||||
<h1 class="display-6 text-white font-weight-bold">@Model.Title.ToUpper()</h1>
|
||||
<p class="display-6 font-weight-bold" id="BtnColor">@Model.Title.ToUpper()</p>
|
||||
@* <p class="fst-italic text-muted">@Html.Raw(Model.Content) <a class="text-primary" href="@Model.Sitecopyright" target="_blank">SeoSoft</a></p> *@
|
||||
but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
||||
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<!-- FOOTER -->
|
||||
<footer class="w-100 py-4 flex-shrink-0">
|
||||
<div class="container py-4">
|
||||
<div class="container">
|
||||
<div class="row justify-content-around">
|
||||
<vc:address></vc:address>
|
||||
<div class="col-lg-2 col-md-6">
|
||||
|
|
@ -35,14 +35,15 @@
|
|||
</div>
|
||||
|
||||
<div class="col-lg-4 col-md-6">
|
||||
<h5 class="text-white mb-3">Newsletter</h5>
|
||||
<h5 class="text-white">Newsletter</h5>
|
||||
|
||||
<form action="#">
|
||||
<vc:subscription></vc:subscription>
|
||||
@* <form action="#">
|
||||
<div class="input-group mb-3">
|
||||
<input class="form-control" type="text" placeholder="Recipient's username" aria-label="Email" aria-describedby="button-addon2">
|
||||
<button class="btn" id="BannerButon" type="button">Subscribe</button>
|
||||
</div>
|
||||
</form>
|
||||
</form> *@
|
||||
|
||||
<ul class="list-unstyled text-muted">
|
||||
@foreach (var footerSocialMedia in Model.FooterSocialMedias)
|
||||
|
|
|
|||
89
Web/Views/Shared/Components/Subscription/Default.cshtml
Normal file
89
Web/Views/Shared/Components/Subscription/Default.cshtml
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
@model Subscription
|
||||
|
||||
<style>
|
||||
/* Custom CSS for transparent form-floating */
|
||||
.form-floating .form-control {
|
||||
box-shadow: 0px 4px 3px -1px rgba(0,0,0,0.58);
|
||||
-webkit-box-shadow: 0px 4px 3px -1px rgba(0,0,0,0.58);
|
||||
border: none;
|
||||
width: 20%;
|
||||
border-radius: 3px;
|
||||
border-bottom: 1px solid #33b3ae; /* Bottom underline */
|
||||
border-top: 1px solid #33b3ae;
|
||||
border-left: 1px solid #33b3ae;
|
||||
background-color: transparent; /* Make input transparent */
|
||||
color: white; /* Set text color */
|
||||
height: calc(2.2rem + calc(var(--bs-border-width)* 2)) !important;
|
||||
}
|
||||
|
||||
.form-floating > label {
|
||||
padding-left: 10px !important;
|
||||
}
|
||||
|
||||
.form-floating label {
|
||||
color: white; /* Set label color */
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
/* Remove focus styling */
|
||||
.form-floating .form-control:focus {
|
||||
box-shadow: none !important; /* Remove box shadow */
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
border-bottom: 1px solid #33b3ae;
|
||||
border-top: 1px solid #33b3ae;
|
||||
border-left: 1px solid #33b3ae;
|
||||
}
|
||||
|
||||
/* Override placeholder color */
|
||||
::placeholder {
|
||||
color: rgba(255, 255, 255, 0.5); /* Set placeholder color */
|
||||
}
|
||||
|
||||
.input-group-text {
|
||||
background-color: #33b3ae;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<form asp-action="Subscribe" asp-controller="Subscription" method="post">
|
||||
<div class="form-floating">
|
||||
<input type="hidden" asp-for="Id" />
|
||||
<div class="input-group mb-3">
|
||||
<input asp-for="Email" class="form-control" type="text" placeholder="Email..." aria-label="Email" aria-describedby="button-addon2">
|
||||
|
||||
<button class="btn btn-sm" id="BannerButon" type="submit">Subscribe</button>
|
||||
</div>
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@* <form asp-action="Subscribe" asp-controller="Subscription" method="post">
|
||||
|
||||
|
||||
<div class="form-floating">
|
||||
<div class="input-group mb-3">
|
||||
<input asp-for="Email" class="form-control" type="text" placeholder="Email..." aria-label="Email" aria-describedby="button-addon2">
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="btn btn-sm" id="BannerButon" type="submit">Subscribe</button>
|
||||
|
||||
|
||||
|
||||
</form> *@
|
||||
|
||||
|
||||
|
||||
@section Scripts {
|
||||
|
||||
|
||||
@{
|
||||
<partial name="_ValidationScriptsPartial" />
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,8 @@
|
|||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/Web.styles.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
|
|
@ -24,8 +26,8 @@
|
|||
</ul>
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a href="#" class="btn btn-sm " id="BannerButon"> Sign in <i class="bi bi-ui-checks"></i></a> |
|
||||
<a href="#" class="btn btn-sm" id="BannerButon"> Sign up <i class="bi bi-ui-checks"></i></a>
|
||||
<a href="#" class="btn btn-sm " id="BannerButon"> Sign in <i class="bi bi-person-check-fill"></i></a> |
|
||||
<a href="#" class="btn btn-sm" id="BannerButon"> Sign up <i class="bi bi-person-fill-add"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -36,6 +38,7 @@
|
|||
<main role="main">
|
||||
|
||||
<vc:banner></vc:banner>
|
||||
<partial name="_Notification" />
|
||||
|
||||
@RenderBody()
|
||||
|
||||
|
|
|
|||
28
Web/Views/Shared/_Notification.cshtml
Normal file
28
Web/Views/Shared/_Notification.cshtml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
@if (TempData["success"] != null)
|
||||
{
|
||||
<script src="/lib/jquery/dist/jquery.min.js"></script>
|
||||
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
toastr.success('@TempData["success"]')
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
}
|
||||
@if (TempData["error"] != null)
|
||||
{
|
||||
<script src="/lib/jquery/dist/jquery.min.js"></script>
|
||||
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
toastr.info('@TempData["Error"]')
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailJet.Api" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2">
|
||||
|
|
|
|||
|
|
@ -9,5 +9,16 @@
|
|||
|
||||
"ConnectionStrings": {
|
||||
"SurveyVista": "data source=SEO-PC; initial catalog=SurveyVista;integrated security=True; TrustServerCertificate=True;"
|
||||
},
|
||||
"Email": {
|
||||
"From": "mr.qais.yousuf@gmail.com",
|
||||
"ApplicationName": "Online Survey",
|
||||
"ConfirmEmailPath": "Subscription/Confirmation"
|
||||
//"ResetPasswordPath": "account/reset-password"
|
||||
|
||||
},
|
||||
"MailJet": {
|
||||
"ApiKey": "f545eee3a4743464b9d25fb9c5ab3f6c",
|
||||
"SecretKey": "9fa430ef00873fdefe333fdc40ee3f8f"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,9 @@
|
|||
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
}
|
||||
/*_______________________________________________________________________________start of the custom CSS_____________________________________________________________*/
|
||||
|
||||
#Background {
|
||||
background-color: #141c27 !important;
|
||||
}
|
||||
.MainBanner {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
|
@ -53,7 +55,7 @@
|
|||
|
||||
}
|
||||
|
||||
#MainContent {
|
||||
#MainContent{
|
||||
background-color: #33b3ae !important;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
|
@ -173,18 +175,20 @@
|
|||
background-color: #33b3ae !important;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: 30vh;
|
||||
height: 50vh;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.hero {
|
||||
background-color: #141a23;
|
||||
background-color: #141c27;
|
||||
/* background-image: linear-gradient(119deg, rgba(14,12,56,1) 0%, rgba(20,26,35,1) 35%, rgba(24,35,51,1) 66%, rgba(34,49,70,1) 100%);*/
|
||||
}
|
||||
|
||||
|
||||
footer {
|
||||
background: #141a23;
|
||||
background: #141c27;
|
||||
}
|
||||
|
||||
#LinkColor {
|
||||
|
|
@ -285,9 +289,9 @@ body, html {
|
|||
background-color: transparent !important;
|
||||
color: #33b3ae;
|
||||
border: 1px solid #33b3ae !important;
|
||||
box-shadow: 2px 4px 13px -1px rgba(0,0,0,0.75);
|
||||
-webkit-box-shadow: 2px 4px 13px -1px rgba(0,0,0,0.75);
|
||||
-moz-box-shadow: 2px 4px 13px -1px rgba(0,0,0,0.75);
|
||||
box-shadow: 0px 4px 3px -1px rgba(0,0,0,0.58);
|
||||
-webkit-box-shadow: 0px 4px 3px -1px rgba(0,0,0,0.58);
|
||||
-moz-box-shadow: 0px 4px 3px -1px rgba(0,0,0,0.58);
|
||||
}
|
||||
|
||||
#BannerButon:hover {
|
||||
|
|
@ -304,9 +308,9 @@ body, html {
|
|||
background-color: transparent !important;
|
||||
color: #ffffff;
|
||||
border: 1px solid #ffffff !important;
|
||||
box-shadow: 2px 4px 13px -1px rgba(0,0,0,0.75);
|
||||
-webkit-box-shadow: 2px 4px 13px -1px rgba(0,0,0,0.75);
|
||||
-moz-box-shadow: 2px 4px 13px -1px rgba(0,0,0,0.75);
|
||||
box-shadow: 0px 5px 22px -6px rgba(0,0,0,0.48);
|
||||
-webkit-box-shadow: 0px 5px 22px -6px rgba(0,0,0,0.48);
|
||||
-moz-box-shadow: 0px 5px 22px -6px rgba(0,0,0,0.48);
|
||||
}
|
||||
|
||||
#HomeButon:hover {
|
||||
|
|
@ -320,10 +324,10 @@ body, html {
|
|||
|
||||
.navbar {
|
||||
margin-bottom: 0px !important;
|
||||
background-color: #161d27 !important;
|
||||
-webkit-box-shadow: 1px 6px 5px -3px rgba(82,81,82,1) !important;
|
||||
-moz-box-shadow: 1px 6px 5px -3px rgba(82,81,82,1) !important;
|
||||
box-shadow: 1px 6px 5px -3px rgba(82,81,82,1) !important;
|
||||
background-color: #16202d !important;
|
||||
box-shadow: 0px 2px 5px 0px rgba(140,140,140,0.79) !important;
|
||||
-webkit-box-shadow: 0px 2px 5px 0px rgba(140,140,140,0.79) !important;
|
||||
-moz-box-shadow: 0px 2px 5px 0px rgba(140,140,140,0.79) !important;
|
||||
}
|
||||
.navbar-brand {
|
||||
color: #33b3ae !important;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue