troche chujowo ale dziala

This commit is contained in:
s440054 2018-12-18 15:42:39 +01:00
parent 57b54662ec
commit 66bad5435a
28 changed files with 60 additions and 116 deletions

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Forum.DataAccessLayer.Models
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -1,8 +1,6 @@
namespace Forum.DataAccessLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class Dbinit : DbMigration
{
public override void Up()

View File

@ -1,8 +1,6 @@
namespace Forum.DataAccessLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class ConfigureDbTables : DbMigration
{
public override void Up()

View File

@ -1,8 +1,6 @@
namespace Forum.DataAccessLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class Emailvalidation : DbMigration
{
public override void Up()

View File

@ -1,8 +1,6 @@
namespace Forum.DataAccessLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class AddedTitle : DbMigration
{
public override void Up()

View File

@ -1,8 +1,6 @@
namespace Forum.DataAccessLayer.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class Seedtry : DbMigration
{
public override void Up()

View File

@ -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<Forum.DataAccessLayer.ApplicationDbContext>

View File

@ -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

View File

@ -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
{

View File

@ -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
{

View File

@ -1,5 +1,4 @@
using System.Web;
using System.Web.Optimization;
using System.Web.Optimization;
namespace MailSender
{

View File

@ -1,5 +1,4 @@
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;
namespace MailSender
{

View File

@ -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

View File

@ -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");
}
}
}

View File

@ -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<Models.MailModel>(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)
{

View File

@ -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;

View File

@ -159,6 +159,7 @@
<Compile Include="App_Start\BundleConfig.cs" />
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Controllers\DefaultController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
@ -207,6 +208,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Views\Default\" />
</ItemGroup>
<ItemGroup>
<Content Include="fonts\glyphicons-halflings-regular.woff2" />

View File

@ -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; }
}
}

View File

@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Informacje ogólne o zestawie zależą od poniższego

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MailSender
namespace MailSender
{
public class Settings
{

View File

@ -9,27 +9,27 @@
<h3>Error: @ViewData["mailErr"]</h3>
}
@using (Html.BeginForm("Index", "Home", FormMethod.Post))
@using (Html.BeginForm("Send", "Home", FormMethod.Post))
{
<div class="form-group">
@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)
</div>
<div class="form-group">
@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)
</div>
<div class="form-group" >
@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)
</div>
<input type="submit" value="Send" class="answer-list__add-btn answer-list__add-btn--sendButton" />
<input type="submit" value="Wyślij" class="answer-list__add-btn answer-list__add-btn--sendButton" />
}
@section Scripts {