From 66bad5435a26208eb1b74373f4de18eb22a16b33 Mon Sep 17 00:00:00 2001 From: s440054 Date: Tue, 18 Dec 2018 15:42:39 +0100 Subject: [PATCH] troche chujowo ale dziala --- .../Forum.DataAccessLayer.Models/Answer.cs | 4 ---- .../Forum.DataAccessLayer.Models/Category.cs | 6 +---- .../ProfessionalUser.cs | 8 +------ .../Properties/AssemblyInfo.cs | 1 - .../Forum.DataAccessLayer.Models/Question.cs | 3 --- .../ContextProviders/ApplicationDbContext.cs | 9 +------ .../Managers/ApplicationSignInManager.cs | 9 +------ .../Managers/ApplicationUserManager.cs | 8 ------- .../Migrations/201812012107132_Db init.cs | 4 +--- .../201812012140435_Configure Db Tables.cs | 4 +--- .../201812012143359_Email validation.cs | 4 +--- .../Migrations/201812012216378_Added Title.cs | 4 +--- .../Migrations/201812012312365_Seedtry.cs | 4 +--- .../Migrations/Configuration.cs | 2 -- .../Properties/AssemblyInfo.cs | 1 - .../Services/MailService.cs | 7 +----- .../Services/SmsService.cs | 7 +----- .../MailSender/App_Start/BundleConfig.cs | 3 +-- .../MailSender/App_Start/FilterConfig.cs | 3 +-- .../Forum/MailSender/App_Start/RouteConfig.cs | 6 +---- .../Controllers/DefaultController.cs | 21 ++++++++++++++++ .../MailSender/Controllers/HomeController.cs | 24 +++++++++++-------- Trunk/Server/Forum/MailSender/Global.asax.cs | 6 +---- .../Server/Forum/MailSender/MailSender.csproj | 2 ++ .../Forum/MailSender/Models/MailModel.cs | 8 ++----- .../MailSender/Properties/AssemblyInfo.cs | 1 - Trunk/Server/Forum/MailSender/Settings.cs | 7 +----- .../Forum/MailSender/Views/Home/Index.cshtml | 10 ++++---- 28 files changed, 60 insertions(+), 116 deletions(-) create mode 100644 Trunk/Server/Forum/MailSender/Controllers/DefaultController.cs diff --git a/Trunk/Components/Forum.DataAccessLayer.Models/Answer.cs b/Trunk/Components/Forum.DataAccessLayer.Models/Answer.cs index b28a4ba..8b56871 100644 --- a/Trunk/Components/Forum.DataAccessLayer.Models/Answer.cs +++ b/Trunk/Components/Forum.DataAccessLayer.Models/Answer.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Forum.DataAccessLayer.Models { diff --git a/Trunk/Components/Forum.DataAccessLayer.Models/Category.cs b/Trunk/Components/Forum.DataAccessLayer.Models/Category.cs index d63964c..933a14f 100644 --- a/Trunk/Components/Forum.DataAccessLayer.Models/Category.cs +++ b/Trunk/Components/Forum.DataAccessLayer.Models/Category.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Forum.DataAccessLayer.Models { diff --git a/Trunk/Components/Forum.DataAccessLayer.Models/ProfessionalUser.cs b/Trunk/Components/Forum.DataAccessLayer.Models/ProfessionalUser.cs index 1b37b7b..cb5d177 100644 --- a/Trunk/Components/Forum.DataAccessLayer.Models/ProfessionalUser.cs +++ b/Trunk/Components/Forum.DataAccessLayer.Models/ProfessionalUser.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using System.Text; +using System.Security.Claims; using System.Threading.Tasks; -using Microsoft.AspNet.Identity; -using Microsoft.AspNet.Identity.EntityFramework; namespace Forum.DataAccessLayer.Models { diff --git a/Trunk/Components/Forum.DataAccessLayer.Models/Properties/AssemblyInfo.cs b/Trunk/Components/Forum.DataAccessLayer.Models/Properties/AssemblyInfo.cs index 2eec4a5..d5890ce 100644 --- a/Trunk/Components/Forum.DataAccessLayer.Models/Properties/AssemblyInfo.cs +++ b/Trunk/Components/Forum.DataAccessLayer.Models/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/Trunk/Components/Forum.DataAccessLayer.Models/Question.cs b/Trunk/Components/Forum.DataAccessLayer.Models/Question.cs index e51e1b7..1f008fd 100644 --- a/Trunk/Components/Forum.DataAccessLayer.Models/Question.cs +++ b/Trunk/Components/Forum.DataAccessLayer.Models/Question.cs @@ -1,9 +1,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Forum.DataAccessLayer.Models { diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/ContextProviders/ApplicationDbContext.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/ContextProviders/ApplicationDbContext.cs index afe79fd..bf6d612 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/ContextProviders/ApplicationDbContext.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/ContextProviders/ApplicationDbContext.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Data.Entity; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Forum.DataAccessLayer.Models; -using Microsoft.AspNet.Identity.EntityFramework; +using Forum.DataAccessLayer.Models; namespace Forum.DataAccessLayer { diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Managers/ApplicationSignInManager.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Managers/ApplicationSignInManager.cs index b5e6368..4191317 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Managers/ApplicationSignInManager.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Managers/ApplicationSignInManager.cs @@ -1,13 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using System.Text; +using System.Security.Claims; using System.Threading.Tasks; using Forum.DataAccessLayer.Models; -using Microsoft.AspNet.Identity.Owin; -using Microsoft.Owin; -using Microsoft.Owin.Security; namespace Forum.DataAccessLayer.Managers { diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Managers/ApplicationUserManager.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Managers/ApplicationUserManager.cs index 8b31ffc..9d07078 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Managers/ApplicationUserManager.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Managers/ApplicationUserManager.cs @@ -1,14 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Forum.DataAccessLayer.Models; using Forum.DataAccessLayer.Services; -using Microsoft.AspNet.Identity; -using Microsoft.AspNet.Identity.EntityFramework; -using Microsoft.AspNet.Identity.Owin; -using Microsoft.Owin; namespace Forum.DataAccessLayer.Managers { diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012107132_Db init.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012107132_Db init.cs index 6f7a214..68a7730 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012107132_Db init.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012107132_Db init.cs @@ -1,8 +1,6 @@ namespace Forum.DataAccessLayer.Migrations { - using System; - using System.Data.Entity.Migrations; - + public partial class Dbinit : DbMigration { public override void Up() diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012140435_Configure Db Tables.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012140435_Configure Db Tables.cs index 16c6317..aa207dd 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012140435_Configure Db Tables.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012140435_Configure Db Tables.cs @@ -1,8 +1,6 @@ namespace Forum.DataAccessLayer.Migrations { - using System; - using System.Data.Entity.Migrations; - + public partial class ConfigureDbTables : DbMigration { public override void Up() diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012143359_Email validation.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012143359_Email validation.cs index eae6184..49917a0 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012143359_Email validation.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012143359_Email validation.cs @@ -1,8 +1,6 @@ namespace Forum.DataAccessLayer.Migrations { - using System; - using System.Data.Entity.Migrations; - + public partial class Emailvalidation : DbMigration { public override void Up() diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012216378_Added Title.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012216378_Added Title.cs index 3d418b2..aacce51 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012216378_Added Title.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012216378_Added Title.cs @@ -1,8 +1,6 @@ namespace Forum.DataAccessLayer.Migrations { - using System; - using System.Data.Entity.Migrations; - + public partial class AddedTitle : DbMigration { public override void Up() diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012312365_Seedtry.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012312365_Seedtry.cs index eabc681..4effbfd 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012312365_Seedtry.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012312365_Seedtry.cs @@ -1,8 +1,6 @@ namespace Forum.DataAccessLayer.Migrations { - using System; - using System.Data.Entity.Migrations; - + public partial class Seedtry : DbMigration { public override void Up() diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/Configuration.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/Configuration.cs index 4df9fcb..7528bf7 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/Configuration.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/Configuration.cs @@ -4,8 +4,6 @@ using Forum.DataAccessLayer.Models; namespace Forum.DataAccessLayer.Migrations { using System; - using System.Data.Entity; - using System.Data.Entity.Migrations; using System.Linq; internal sealed class Configuration : DbMigrationsConfiguration diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Properties/AssemblyInfo.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Properties/AssemblyInfo.cs index 6f353be..158c778 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Properties/AssemblyInfo.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Services/MailService.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Services/MailService.cs index 8492f55..7292bee 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Services/MailService.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Services/MailService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNet.Identity; +using System.Threading.Tasks; namespace Forum.DataAccessLayer.Services { diff --git a/Trunk/Server/Forum/Forum.DataAccessLayer/Services/SmsService.cs b/Trunk/Server/Forum/Forum.DataAccessLayer/Services/SmsService.cs index 8108592..d290cc3 100644 --- a/Trunk/Server/Forum/Forum.DataAccessLayer/Services/SmsService.cs +++ b/Trunk/Server/Forum/Forum.DataAccessLayer/Services/SmsService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNet.Identity; +using System.Threading.Tasks; namespace Forum.DataAccessLayer.Services { diff --git a/Trunk/Server/Forum/MailSender/App_Start/BundleConfig.cs b/Trunk/Server/Forum/MailSender/App_Start/BundleConfig.cs index ca0b8ff..863100d 100644 --- a/Trunk/Server/Forum/MailSender/App_Start/BundleConfig.cs +++ b/Trunk/Server/Forum/MailSender/App_Start/BundleConfig.cs @@ -1,5 +1,4 @@ -using System.Web; -using System.Web.Optimization; +using System.Web.Optimization; namespace MailSender { diff --git a/Trunk/Server/Forum/MailSender/App_Start/FilterConfig.cs b/Trunk/Server/Forum/MailSender/App_Start/FilterConfig.cs index 310be50..939189a 100644 --- a/Trunk/Server/Forum/MailSender/App_Start/FilterConfig.cs +++ b/Trunk/Server/Forum/MailSender/App_Start/FilterConfig.cs @@ -1,5 +1,4 @@ -using System.Web; -using System.Web.Mvc; +using System.Web.Mvc; namespace MailSender { diff --git a/Trunk/Server/Forum/MailSender/App_Start/RouteConfig.cs b/Trunk/Server/Forum/MailSender/App_Start/RouteConfig.cs index b39f85c..e73abd0 100644 --- a/Trunk/Server/Forum/MailSender/App_Start/RouteConfig.cs +++ b/Trunk/Server/Forum/MailSender/App_Start/RouteConfig.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; +using System.Web.Mvc; using System.Web.Routing; namespace MailSender diff --git a/Trunk/Server/Forum/MailSender/Controllers/DefaultController.cs b/Trunk/Server/Forum/MailSender/Controllers/DefaultController.cs new file mode 100644 index 0000000..b310220 --- /dev/null +++ b/Trunk/Server/Forum/MailSender/Controllers/DefaultController.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using Newtonsoft.Json; + +namespace MailSender.Controllers +{ + [RoutePrefix("def")] + public class DefaultController : Controller + { + [HttpGet] + public ActionResult Index() + { + var model = JsonConvert.SerializeObject(new Models.MailModel() { Content = "DDD", EMailTo = "ddd@o2.pl", Subject = "LLLLLL" }); + TempData.Add("mailModel", model); + return RedirectToAction("Index", "Home"); + } + } +} \ No newline at end of file diff --git a/Trunk/Server/Forum/MailSender/Controllers/HomeController.cs b/Trunk/Server/Forum/MailSender/Controllers/HomeController.cs index e0e154c..472b80a 100644 --- a/Trunk/Server/Forum/MailSender/Controllers/HomeController.cs +++ b/Trunk/Server/Forum/MailSender/Controllers/HomeController.cs @@ -1,21 +1,25 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Net.Mail; +using System.Net.Mail; using System.Net; using System.Web.Mvc; -using System.Web.Helpers; -using System.Threading.Tasks; +using System.Net.Http; +using System.Web.ModelBinding; +using System; +using Newtonsoft.Json; namespace MailSender.Controllers { public class HomeController : Controller - { + { [HttpGet] public ActionResult Index() { - return View(new Models.MailModel()); + string jsonString = TempData["mailModel"] as string; + Models.MailModel model = null; + if (!String.IsNullOrEmpty(jsonString)) + model = JsonConvert.DeserializeObject(jsonString); + if (model == null) + model = new Models.MailModel(); + return View(model); } [HttpGet] @@ -26,7 +30,7 @@ namespace MailSender.Controllers } [HttpPost] - public ActionResult Index(MailSender.Models.MailModel model) + public ActionResult Send(MailSender.Models.MailModel model) { if (ModelState.IsValid) { diff --git a/Trunk/Server/Forum/MailSender/Global.asax.cs b/Trunk/Server/Forum/MailSender/Global.asax.cs index b47ca74..03e5a66 100644 --- a/Trunk/Server/Forum/MailSender/Global.asax.cs +++ b/Trunk/Server/Forum/MailSender/Global.asax.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; +using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; diff --git a/Trunk/Server/Forum/MailSender/MailSender.csproj b/Trunk/Server/Forum/MailSender/MailSender.csproj index 0d45204..384283f 100644 --- a/Trunk/Server/Forum/MailSender/MailSender.csproj +++ b/Trunk/Server/Forum/MailSender/MailSender.csproj @@ -159,6 +159,7 @@ + Global.asax @@ -207,6 +208,7 @@ + diff --git a/Trunk/Server/Forum/MailSender/Models/MailModel.cs b/Trunk/Server/Forum/MailSender/Models/MailModel.cs index 8e2f4ed..cecccc4 100644 --- a/Trunk/Server/Forum/MailSender/Models/MailModel.cs +++ b/Trunk/Server/Forum/MailSender/Models/MailModel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Data.Entity; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace MailSender.Models @@ -33,5 +28,6 @@ namespace MailSender.Models [DataType(DataType.MultilineText)] [StringLength(500, ErrorMessage = "Message has to have between 1 and 500 chars", MinimumLength = 1)] public string Content { get; set; } + } } \ No newline at end of file diff --git a/Trunk/Server/Forum/MailSender/Properties/AssemblyInfo.cs b/Trunk/Server/Forum/MailSender/Properties/AssemblyInfo.cs index 61b2ce1..cc77d69 100644 --- a/Trunk/Server/Forum/MailSender/Properties/AssemblyInfo.cs +++ b/Trunk/Server/Forum/MailSender/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Informacje ogólne o zestawie zależą od poniższego diff --git a/Trunk/Server/Forum/MailSender/Settings.cs b/Trunk/Server/Forum/MailSender/Settings.cs index 364a3a5..7fb56b1 100644 --- a/Trunk/Server/Forum/MailSender/Settings.cs +++ b/Trunk/Server/Forum/MailSender/Settings.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace MailSender +namespace MailSender { public class Settings { diff --git a/Trunk/Server/Forum/MailSender/Views/Home/Index.cshtml b/Trunk/Server/Forum/MailSender/Views/Home/Index.cshtml index 8d382a9..93b9e7b 100644 --- a/Trunk/Server/Forum/MailSender/Views/Home/Index.cshtml +++ b/Trunk/Server/Forum/MailSender/Views/Home/Index.cshtml @@ -9,27 +9,27 @@

Error: @ViewData["mailErr"]

} -@using (Html.BeginForm("Index", "Home", FormMethod.Post)) +@using (Html.BeginForm("Send", "Home", FormMethod.Post)) {
@Html.LabelFor(i => i.Subject, new { @class = "label-form" }) - @Html.EditorFor(i => i.Subject, new { htmlAttributes = new { @class = "form-control form-emailsend", @placeholder = "Temat" } }) + @Html.EditorFor(i => i.Subject, new { htmlAttributes = new { @value = Model.Subject, @class = "form-control form-emailsend", @placeholder = "Temat" } }) @Html.ValidationMessageFor(i => i.Subject)
@Html.LabelFor(i => i.EMailTo, new { @class = "label-form" }) - @Html.EditorFor(i => i.EMailTo, new { htmlAttributes = new { @class = "form-control form-emailsend", @placeholder = "Do" } }) + @Html.EditorFor(i => i.EMailTo, new { htmlAttributes = new { @value = Model.EMailTo, @class = "form-control form-emailsend", @placeholder = "Do" } }) @Html.ValidationMessageFor(i => i.EMailTo)
@Html.LabelFor(i => i.Content, new { @class = "label-form" }) - @Html.EditorFor(i => i.Content, new { htmlAttributes = new { @class = "form-control", @id = "exampleFormControlTextarea3", @rows=9, @placeholder = "Odpowiedź" } }) + @Html.EditorFor(i => i.Content, new { htmlAttributes = new { @value = Model.Content, @class = "form-control", @id = "exampleFormControlTextarea3", @rows=9, @placeholder = "Odpowiedź" } }) @Html.ValidationMessageFor(i => i.Content)
- + } @section Scripts {