Compare commits

..

No commits in common. "master" and "branch_Norbert_20181204" have entirely different histories.

67 changed files with 350 additions and 1609 deletions

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

@ -1,4 +1,8 @@
using System.Security.Claims; using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.AspNet.Identity.EntityFramework;

View File

@ -1,4 +1,5 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@ -1,6 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Forum.DataAccessLayer.Models namespace Forum.DataAccessLayer.Models
{ {

View File

@ -1,4 +1,9 @@
using System.Data.Entity; 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 Forum.DataAccessLayer.Models;
using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.AspNet.Identity.EntityFramework;

View File

@ -1,4 +1,8 @@
using System.Security.Claims; using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Forum.DataAccessLayer.Models; using Forum.DataAccessLayer.Models;
using Microsoft.AspNet.Identity.Owin; using Microsoft.AspNet.Identity.Owin;

View File

@ -1,4 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Forum.DataAccessLayer.Models; using Forum.DataAccessLayer.Models;
using Forum.DataAccessLayer.Services; using Forum.DataAccessLayer.Services;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Entity.Migrations;
using Forum.DataAccessLayer.Models; using Forum.DataAccessLayer.Models;
namespace Forum.DataAccessLayer.Migrations namespace Forum.DataAccessLayer.Migrations
{ {
using System; using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq; using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<Forum.DataAccessLayer.ApplicationDbContext> internal sealed class Configuration : DbMigrationsConfiguration<Forum.DataAccessLayer.ApplicationDbContext>

View File

@ -1,4 +1,5 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@ -1,4 +1,8 @@
using System.Threading.Tasks; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
namespace Forum.DataAccessLayer.Services namespace Forum.DataAccessLayer.Services

View File

@ -1,4 +1,8 @@
using System.Threading.Tasks; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
namespace Forum.DataAccessLayer.Services namespace Forum.DataAccessLayer.Services

View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26730.15 VisualStudioVersion = 15.0.28307.136
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forum", "Forum\Forum.csproj", "{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forum", "Forum\Forum.csproj", "{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}"
EndProject EndProject
@ -13,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forum.DataAccessLayer", "Fo
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MailSender", "MailSender\MailSender.csproj", "{24F3A3E9-F8B9-43A5-A5AB-FA627683750C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MailSender", "MailSender\MailSender.csproj", "{24F3A3E9-F8B9-43A5-A5AB-FA627683750C}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MailDTO", "MailDTO\MailDTO.csproj", "{07B5BD11-726F-4506-9FD8-783880AAE0EF}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -37,10 +35,6 @@ Global
{24F3A3E9-F8B9-43A5-A5AB-FA627683750C}.Debug|Any CPU.Build.0 = Debug|Any CPU {24F3A3E9-F8B9-43A5-A5AB-FA627683750C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24F3A3E9-F8B9-43A5-A5AB-FA627683750C}.Release|Any CPU.ActiveCfg = Release|Any CPU {24F3A3E9-F8B9-43A5-A5AB-FA627683750C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24F3A3E9-F8B9-43A5-A5AB-FA627683750C}.Release|Any CPU.Build.0 = Release|Any CPU {24F3A3E9-F8B9-43A5-A5AB-FA627683750C}.Release|Any CPU.Build.0 = Release|Any CPU
{07B5BD11-726F-4506-9FD8-783880AAE0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07B5BD11-726F-4506-9FD8-783880AAE0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07B5BD11-726F-4506-9FD8-783880AAE0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07B5BD11-726F-4506-9FD8-783880AAE0EF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -1,386 +1,24 @@
body { body {
padding-top: 15rem; padding-top: 50px;
padding-bottom: 20px; padding-bottom: 20px;
} }
/* Set padding to keep content from hitting the edges */ /* Set padding to keep content from hitting the edges */
.body-content { .body-content {
padding-left: 15px; padding-left: 15px;
padding-right: 15px; padding-right: 15px;
} }
/* Override the default bootstrap behavior where horizontal description lists /* Override the default bootstrap behavior where horizontal description lists
will truncate terms that are too long to fit in the left column will truncate terms that are too long to fit in the left column
*/ */
.dl-horizontal dt { .dl-horizontal dt {
white-space: normal; white-space: normal;
} }
/* Set width on the form input elements since they're 100% wide by default */ /* Set width on the form input elements since they're 100% wide by default */
input, input,
select select,
{ textarea {
max-width: 280px; max-width: 280px;
} }
.navbar {
background: linear-gradient(#47478f 15%,#4d4794);
height: auto;
}
.navbar a {
color: #fafafa;
}
h2{
margin: 1rem 0;
}
.navbar-toggle .icon-bar {
background: #b7c5d8;
width: 28px;
}
.navbar-brand{
font-size:2.5rem;
font-weight:700;
height:70px;
line-height:4rem;
}
.navbar-toggle{
margin-top:18px;
}
.navbar > .container {
width: 90%;
}
.nav > li > a:hover, .nav > li > a:focus{
background-color:#5a5aa7 ;
}
.category-list-wrapper{
width:80%;
margin:0 auto;
}
.category-wrapper > ul {
list-style: none;
}
.category-list{
display: grid;
padding:0;
grid-row-gap: 2rem;
}
.category-list > li {
height: 9rem;
display: flex;
justify-content: center;
align-items: center;
background-color:#bbbbc5;
border-radius: 1rem;
position:relative;
}
.category-list > li > a {
text-decoration: none;
color: #fafafa;
font-size: 3rem;
display: block;
width: 100%;
height: 100%;
text-align: center;
line-height: 9rem;
overflow: hidden;
}
.single-category-wrapper{
padding: 3rem;
background-color: #f2f2f2;
border-radius: 1rem;
}
.single-category-wrapper > h2 {
margin:1rem 0;
}
.single-category-wrapper > ul {
padding:0;
list-style: none;
}
.single-category-wrapper > ul li {
padding: 1.5rem 0;
font-size:1.5rem;
}
.single-category-wrapper > ul li a {
text-decoration: none;
color: #3b3b3b;
}
.add-topic {
width: 100%;
border: none;
background: #79bd9b;
padding: 10px;
border-radius: 1rem;
font-size: 1.8rem;
margin-top: 1rem;
}
.add-topic > a{
color: #fafafa;
text-decoration: none;
display:block;
width:100%;
height:100%;
}
.form-AddQuestion {
background-color: #f1f1f3;
padding: 3rem;
border-radius: 1rem;
}
.form-AddQuestion input {
max-width: none;
}
.form-personal-data{
display: flex;
flex-direction: column;
width:100%;
justify-content: space-between;
}
.form-personal-data .form-group {
width:100%;
}
.form-AddQuestion input[type=submit], .add-answer input[type=submit] {
border: none;
background: #79bd9b;
padding: 10px;
border-radius: 1rem;
font-size: 1.8rem;
color: #fafafa;
}
.form-AddQuestion input[type=submit]{
margin-top: 1.7rem;
}
.form-AddQuestion__btn{
width:100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
.textarea-wrapper {
width: 50%;
margin: 20px auto;
padding: 5px; /*workaround for textarea margin*/
background: #FFF;
border: 1px solid #808080;
}
textarea {
max-width: none;
width: 100%;
}
.answer-list__question {
background: #dee0eb;
padding: 3rem;
overflow-wrap: break-word;
border-radius: 1rem;
margin-bottom: 5rem;
}
.answer-list__question h2 {
margin:0;
width: 80%;
}
.answer-list__info {
display: flex;
justify-content: space-between;
align-items:center;
}
.answer-list__answer {
list-style: none;
padding:0;
}
.username {
font-weight: 700;
}
.answer-list__answer__info {
background: #4d4c4c;
color: #fafafa;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
border-radius: 1rem;
}
.answer-list__answer__info--proffesional {
background: #c68585;
}
.answer-list__single-answer {
border: 1px solid #c0bebe;
border-radius: 1rem;
margin-bottom: 3rem;
border-top: none;
}
.answer-list__content {
padding: 2rem 2rem;
width: 100%;
overflow-wrap: break-word;
}
.answer-list__heading {
margin: 2rem 0;
}
.answer-list__add-btn {
border: none;
background: #79bd9b;
border-radius: 1rem;
font-size: 1.8rem;
color: #fafafa;
width: 20rem;
display: flex;
justify-content:center;
align-items:center;
height: 5rem;
}
.answer-list__add-btn a {
text-decoration: none;
display: block;
width: 100%;
height: 100%;
color: white;
text-align: center;
line-height: 5rem;
}
.add-answer {
background: #f2f2f2;
padding: 3rem;
border-radius: 1rem;
}
.wrapper {
padding: 3rem;
background-color: #f2f2f2;
}
.delete-category__span{
font-size:2rem;
font-weight:400;
margin-bottom:10rem;
}
.delete-category__dl {
height: 3rem;
margin-bottom: 3rem;
}
@media (min-width: 768px) {
.navbar > .container {
height: 10rem;
}
.navbar-header {
height: 100%;
display: flex;
align-items: center;
}
.navbar-brand {
font-size: 3.5rem;
}
.navbar-nav {
height: 100px;
display: flex;
align-items: center;
}
.navbar-nav > li {
height: 50%;
}
.navbar-nav > li > a {
height: 100%;
border-radius: 0.8rem;
}
.nav > li > a:hover, .nav > li > a:focus {
transition: background-color .1s ease;
}
.category-list {
grid-template-columns: 1fr 1fr;
grid-column-gap: 2rem;
}
.single-category-wrapper {
width: 65%;
margin: 0 auto;
}
.form-AddQuestion__btn {
flex-direction: row;
margin-top: 1rem;
}
.form-personal-data {
flex-direction: row;
}
.form-personal-data .form-group {
width: 49%;
}
.form-AddQuestion input[type=submit] {
margin-top: 0;
}
}

View File

@ -20,7 +20,9 @@ namespace Forum.Controllers
private ApplicationSignInManager _signInManager; private ApplicationSignInManager _signInManager;
private ApplicationUserManager _userManager; private ApplicationUserManager _userManager;
public AccountController(){} public AccountController()
{
}
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager ) public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager )
{ {
@ -86,7 +88,7 @@ namespace Forum.Controllers
return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }); return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
case SignInStatus.Failure: case SignInStatus.Failure:
default: default:
ModelState.AddModelError("", "Niepoprawny login lub hasło"); ModelState.AddModelError("", "Invalid login attempt.");
return View(model); return View(model);
} }
} }
@ -136,7 +138,7 @@ namespace Forum.Controllers
// //
// GET: /Account/Register // GET: /Account/Register
[Authorize] [AllowAnonymous]
public ActionResult Register() public ActionResult Register()
{ {
return View(); return View();
@ -145,13 +147,13 @@ namespace Forum.Controllers
// //
// POST: /Account/Register // POST: /Account/Register
[HttpPost] [HttpPost]
[Authorize] [AllowAnonymous]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public async Task<ActionResult> Register(RegisterViewModel model) public async Task<ActionResult> Register(RegisterViewModel model)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
var user = new ProfessionalUser() { UserName = model.Email, Email = model.Email,FullName = model.FullName}; var user = new ProfessionalUser() { UserName = model.Email, Email = model.Email };
var result = await UserManager.CreateAsync(user, model.Password); var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded) if (result.Succeeded)
{ {

View File

@ -1,114 +0,0 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using Forum.DataAccessLayer;
using Forum.DataAccessLayer.Models;
namespace Forum.Controllers
{
[Authorize]
public class CategoriesController : Controller
{
private ApplicationDbContext db = new ApplicationDbContext();
// GET: Categories
public ActionResult Index()
{
return View(db.Categories.ToList());
}
// GET: Categories/Create
public ActionResult Create()
{
return View();
}
// POST: Categories/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see https://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "Id,CategoryName")] Category category)
{
if (ModelState.IsValid)
{
db.Categories.Add(category);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(category);
}
// GET: Categories/Edit/5
public ActionResult Edit(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Category category = db.Categories.Find(id);
if (category == null)
{
return HttpNotFound();
}
return View(category);
}
// POST: Categories/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see https://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include = "Id,CategoryName")] Category category)
{
if (ModelState.IsValid)
{
db.Entry(category).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(category);
}
// GET: Categories/Delete/5
public ActionResult Delete(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Category category = db.Categories.Find(id);
if (category == null)
{
return HttpNotFound();
}
return View(category);
}
// POST: Categories/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteConfirmed(int id)
{
Category category = db.Categories.Find(id);
db.Categories.Remove(category);
db.SaveChanges();
return RedirectToAction("Index");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
}
}

View File

@ -1,16 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity; using System.Data.Entity;
using System.Linq; using System.Linq;
using System.Security.Principal;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Mvc; using System.Web.Mvc;
using Fluentx.Mvc;
using Forum.DataAccessLayer; using Forum.DataAccessLayer;
using Forum.DataAccessLayer.Models; using Forum.DataAccessLayer.Models;
using Forum.ViewModels; using Forum.ViewModels;
using Microsoft.AspNet.Identity;
namespace Forum.Controllers namespace Forum.Controllers
{ {
@ -104,54 +99,19 @@ namespace Forum.Controllers
if (question == null) if (question == null)
return HttpNotFound(); return HttpNotFound();
var user = _dbContext.Users.Find(User.Identity.GetUserId());
var answer = new Answer() var answer = new Answer()
{ {
Content = model.Content, Content = model.Content,
Nick = model.Nick, Nick = model.Nick,
Date = DateTime.Now, Date = DateTime.Now
Professional = user
}; };
question.Answers.Add(answer); question.Answers.Add(answer);
_dbContext.SaveChanges(); _dbContext.SaveChanges();
//Logika wysylania maili
if (User.Identity.IsAuthenticated && !string.IsNullOrEmpty(question.ReportersEmail))
{
var dataToPost = new Dictionary<string, object>();
dataToPost.Add("Subject",question.Title);
dataToPost.Add("EMailTo",question.ReportersEmail);
dataToPost.Add("Content",model.Content);
return this.RedirectAndPost(ConfigurationManager.AppSettings["MailSenderAddress"], dataToPost);
}
return RedirectToAction("Question", new {id = model.QuestionId}); return RedirectToAction("Question", new {id = model.QuestionId});
} }
[Authorize]
[System.Web.Mvc.Route("Home/DeleteAnswer/{id}")]
public ActionResult DeleteAnswer(int? id)
{
var answer = _dbContext.Answers.Find(id);
var question = _dbContext.Questions.FirstOrDefault(x => x.Answers.Any(y => y.Id == id));
if (answer != null)
{
_dbContext.Answers.Remove(answer);
_dbContext.SaveChanges();
}
if (question != null)
return RedirectToAction("Question", new {id = question.Id});
return HttpNotFound();
}
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -47,12 +47,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Fluentx, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Fluentx.2.0.4\lib\Fluentx.dll</HintPath>
</Reference>
<Reference Include="Fluentx.Mvc, Version=1.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Fluentx.Mvc.1.0.4\lib\Fluentx.Mvc.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.TelemetryCorrelation, Version=1.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.AspNet.TelemetryCorrelation, Version=1.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.TelemetryCorrelation.1.0.4\lib\net45\Microsoft.AspNet.TelemetryCorrelation.dll</HintPath> <HintPath>..\packages\Microsoft.AspNet.TelemetryCorrelation.1.0.4\lib\net45\Microsoft.AspNet.TelemetryCorrelation.dll</HintPath>
</Reference> </Reference>
@ -182,7 +176,6 @@
<Compile Include="App_Start\RouteConfig.cs" /> <Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\Startup.Auth.cs" /> <Compile Include="App_Start\Startup.Auth.cs" />
<Compile Include="Controllers\AccountController.cs" /> <Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\CategoriesController.cs" />
<Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ManageController.cs" /> <Compile Include="Controllers\ManageController.cs" />
<Compile Include="Global.asax.cs"> <Compile Include="Global.asax.cs">
@ -222,8 +215,6 @@
<Content Include="Content\bootstrap.css.map" /> <Content Include="Content\bootstrap.css.map" />
<Content Include="Content\bootstrap-theme.min.css.map" /> <Content Include="Content\bootstrap-theme.min.css.map" />
<Content Include="Content\bootstrap-theme.css.map" /> <Content Include="Content\bootstrap-theme.css.map" />
<None Include="Properties\PublishProfiles\forum-inzynieria1 - FTP.pubxml" />
<None Include="Properties\PublishProfiles\forum-inzynieria1 - Web Deploy.pubxml" />
<None Include="Scripts\jquery-3.3.1.intellisense.js" /> <None Include="Scripts\jquery-3.3.1.intellisense.js" />
<Content Include="Scripts\jquery-3.3.1.js" /> <Content Include="Scripts\jquery-3.3.1.js" />
<Content Include="Scripts\jquery-3.3.1.min.js" /> <Content Include="Scripts\jquery-3.3.1.min.js" />
@ -243,9 +234,7 @@
<Content Include="Scripts\umd\popper-utils.min.js" /> <Content Include="Scripts\umd\popper-utils.min.js" />
<Content Include="Scripts\umd\popper.js" /> <Content Include="Scripts\umd\popper.js" />
<Content Include="Scripts\umd\popper.min.js" /> <Content Include="Scripts\umd\popper.min.js" />
<Content Include="Web.config"> <Content Include="Web.config" />
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Debug.config"> <Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon> <DependentUpon>Web.config</DependentUpon>
</Content> </Content>
@ -290,14 +279,9 @@
<Content Include="Scripts\popper-utils.js.map" /> <Content Include="Scripts\popper-utils.js.map" />
<Content Include="Views\Home\AddQuestion.cshtml" /> <Content Include="Views\Home\AddQuestion.cshtml" />
<Content Include="Views\Home\AddAnswer.cshtml" /> <Content Include="Views\Home\AddAnswer.cshtml" />
<Content Include="Views\Categories\Create.cshtml" />
<Content Include="Views\Categories\Delete.cshtml" />
<Content Include="Views\Categories\Edit.cshtml" />
<Content Include="Views\Categories\Index.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
<Folder Include="Views\Professional\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />

View File

@ -55,10 +55,10 @@ namespace Forum.Models
[Required] [Required]
[DataType(DataType.Password)] [DataType(DataType.Password)]
[Display(Name = "Hasło")] [Display(Name = "Password")]
public string Password { get; set; } public string Password { get; set; }
[Display(Name = "Zapamiętaj mnie")] [Display(Name = "Remember me?")]
public bool RememberMe { get; set; } public bool RememberMe { get; set; }
} }
@ -72,17 +72,13 @@ namespace Forum.Models
[Required] [Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)] [DataType(DataType.Password)]
[Display(Name = "Hasło")] [Display(Name = "Password")]
public string Password { get; set; } public string Password { get; set; }
[DataType(DataType.Password)] [DataType(DataType.Password)]
[Display(Name = "Potwierdź hasło")] [Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; } public string ConfirmPassword { get; set; }
[Display(Name = "Imię i nazwisko")]
[Required]
public string FullName { get; set; }
} }
public class ResetPasswordViewModel public class ResetPasswordViewModel

View File

@ -1,7 +1,7 @@
@using Forum.Models @using Forum.Models
@model LoginViewModel @model LoginViewModel
@{ @{
ViewBag.Title = "Zaloguj się"; ViewBag.Title = "Log in";
} }
<h2>@ViewBag.Title.</h2> <h2>@ViewBag.Title.</h2>
@ -11,6 +11,7 @@
@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{ {
@Html.AntiForgeryToken() @Html.AntiForgeryToken()
<h4>Use a local account to log in.</h4>
<hr /> <hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group"> <div class="form-group">
@ -37,11 +38,11 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <div class="col-md-offset-2 col-md-10">
<input type="submit" value="Zaloguj się" class="btn btn-default" /> <input type="submit" value="Log in" class="btn btn-default" />
</div> </div>
</div> </div>
<p> <p>
@*@Html.ActionLink("Utwórz nowego użytkownika", "Register")*@ @Html.ActionLink("Register as a new user", "Register")
</p> </p>
@* Enable this once you have account confirmation enabled for password reset functionality @* Enable this once you have account confirmation enabled for password reset functionality
<p> <p>
@ -50,7 +51,11 @@
} }
</section> </section>
</div> </div>
<div class="col-md-4">
<section id="socialLoginForm">
@Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { ReturnUrl = ViewBag.ReturnUrl })
</section>
</div>
</div> </div>
@section Scripts { @section Scripts {

View File

@ -1,6 +1,6 @@
@model Forum.Models.RegisterViewModel @model Forum.Models.RegisterViewModel
@{ @{
ViewBag.Title = "Zarejestruj się"; ViewBag.Title = "Register";
} }
<h2>@ViewBag.Title.</h2> <h2>@ViewBag.Title.</h2>
@ -8,6 +8,7 @@
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) @using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{ {
@Html.AntiForgeryToken() @Html.AntiForgeryToken()
<h4>Create a new account.</h4>
<hr /> <hr />
@Html.ValidationSummary("", new { @class = "text-danger" }) @Html.ValidationSummary("", new { @class = "text-danger" })
<div class="form-group"> <div class="form-group">
@ -16,12 +17,6 @@
@Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) @Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
</div> </div>
</div> </div>
<div class="form-group">
@Html.LabelFor(m => m.FullName, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.FullName, new { @class = "form-control" })
</div>
</div>
<div class="form-group"> <div class="form-group">
@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
<div class="col-md-10"> <div class="col-md-10">
@ -36,7 +31,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <div class="col-md-offset-2 col-md-10">
<input type="submit" class="btn btn-default" value="Zarejestruj" /> <input type="submit" class="btn btn-default" value="Register" />
</div> </div>
</div> </div>
} }

View File

@ -1,44 +0,0 @@
@model Forum.DataAccessLayer.Models.Category
@{
ViewBag.Title = "Create";
}
<div class="single-category-wrapper">
<h2>Utwórz kategorie</h2>
<hr style="border-top: 1px solid #d3d3d3; margin-bottom: 3rem;" />
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.CategoryName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.CategoryName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.CategoryName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Utwórz kategorie" class="answer-list__add-btn" style="height:4rem; width:17rem" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Powrót", "Index")
</div>
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -1,34 +0,0 @@
@model Forum.DataAccessLayer.Models.Category
@{
ViewBag.Title = "Delete";
}
<div class="single-category-wrapper">
<h2>Usuwanie ketegorii</h2>
<hr style="border-top: 1px solid #d3d3d3;" />
<span class="delete-category__span">Jesteś pewien, że chcesz usunąć kategorię?</span>
<div style="margin-top: 3rem;">
<dl class="dl-horizontal delete-category__dl">
<dt style="text-align:left">
@Html.DisplayNameFor(model => model.CategoryName)
</dt>
<dd style="margin-left:0;">
@Html.DisplayFor(model => model.CategoryName)
</dd>
</dl>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-actions no-color">
<input type="submit" value="Usuń" class="answer-list__add-btn" style="height:4rem; width:17rem; background-color:#af4f4f; margin-bottom: 3rem;" />
</div>
<div>@Html.ActionLink("Powrót do listy kategorii", "Index")
</div>
}
</div>
</div>

View File

@ -1,42 +0,0 @@
@model Forum.DataAccessLayer.Models.Category
@{
ViewBag.Title = "Edit";
}
<div class="single-category-wrapper">
<h2>Edytuj nazwię kategorii</h2>
<hr style="border-top: 1px solid #d3d3d3; margin-bottom: 3rem;" />
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.Id)
<div class="form-group">
@Html.LabelFor(model => model.CategoryName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.CategoryName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.CategoryName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Zapisz" class="answer-list__add-btn" style="height:4rem; width:17rem" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Powrót do listy kategorii", "Index")
</div>
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

View File

@ -1,35 +0,0 @@
@model IEnumerable<Forum.DataAccessLayer.Models.Category>
@{
ViewBag.Title = "Index";
}
<div class="single-category-wrapper">
<h2 style="margin-bottom:3rem;">Kategorie</h2>
<table class="table">
<tr>
<th>
Nazwa kategorii
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.CategoryName)
</td>
<td>
@Html.ActionLink("Edytuj", "Edit", new { id = item.Id }) |
@Html.ActionLink("Usuń", "Delete", new { id = item.Id })
</td>
</tr>
}
</table>
<p class="answer-list__add-btn">
@Html.ActionLink("Utwórz kategorie", "Create")
</p>
</div>

View File

@ -1,45 +1,26 @@
@model Forum.ViewModels.AddAnswerViewModel @model Forum.ViewModels.AddAnswerViewModel
@{ @{
ViewBag.Title = "AddAnswer"; ViewBag.Title = "AddAnswer";
} }
<h2>AddAnswer</h2>
<div class="add-answer">
<h2>Dodaj odpowiedź</h2> @using (Html.BeginForm("AddAnswer", "Home", FormMethod.Post))
{
<hr style="border-top: 1px solid #d3d3d3; margin-bottom: 3rem;" />
<div class="form-group">
@Html.LabelFor(model => model.Nick, new { @class = "label-form" })
@using (Html.BeginForm("AddAnswer", "Home", FormMethod.Post)) @Html.EditorFor(model => model.Nick, new { htmlAttributes = new { @class = "form-control" } })
{ </div>
<div class="form-group"> <div class="form-group">
@{ @Html.LabelFor(model => model.Content, new { @class = "label-form" })
if (User.Identity.IsAuthenticated) @Html.EditorFor(model => model.Content, new { htmlAttributes = new { @class = "form-control" } })
{ </div>
<label>Odpowiedz jako @User.Identity.Name</label>
} @Html.HiddenFor(model=>model.QuestionId)
else
{ <input type="submit" value="Zgłoś" />
@Html.EditorFor(model => model.Nick, new { htmlAttributes = new { @class = "form-control", placeholder = "Nick" } }) }
}
}
</div>
<div class="form-group">
@Html.TextAreaFor(model => model.Content, new { @class = "form-control", @id = "exampleFormControlTextarea3", rows = 7, placeholder = "Odpowiedź" })<br />
</div>
@Html.HiddenFor(model=>model.QuestionId)
<input type="submit" value="Zgłoś odpowiedź" />
}
</div>

View File

@ -1,49 +1,38 @@
@model Forum.ViewModels.AddQuestionViewModel @model Forum.ViewModels.AddQuestionViewModel
@{ @{
ViewBag.Title = "AddQuestion"; ViewBag.Title = "AddQuestion";
} }
<h2>AddQuestion</h2>
@using (Html.BeginForm("AddQuestion", "Home", FormMethod.Post)) @using (Html.BeginForm("AddQuestion", "Home", FormMethod.Post))
{ {
<div class="form-AddQuestion"> <div class="form-group">
<h2>Dodaj zapytanie</h2> @Html.LabelFor(model => model.Title, new { @class = "label-form" })
<hr style="border-top: 1px solid #d3d3d3; margin-bottom:3rem;" /> @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
</div>
<div class="form-group">
<div class="form-group"> @Html.LabelFor(model => model.Content, new { @class = "label-form" })
@Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control", placeholder="Temat" } }) @Html.EditorFor(model => model.Content, new { htmlAttributes = new { @class = "form-control" } })
</div> </div>
<div class="form-group"> <div class="form-group">
@Html.LabelFor(model => model.Nick, new { @class = "label-form" })
@Html.EditorFor(model => model.Nick, new { htmlAttributes = new { @class = "form-control" } })
@Html.TextAreaFor(model => model.Content, new { @class="form-control", @id = "exampleFormControlTextarea3", rows=7, placeholder="Treść zapytania" })<br /> </div>
</div> <div class="form-group">
<div class="form-personal-data"> @Html.LabelFor(model => model.Email, new { @class = "label-form" })
<div class="form-group"> @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
@Html.EditorFor(model => model.Nick, new { htmlAttributes = new { @class = "form-control", placeholder="Nick" } }) </div>
</div>
@Html.DropDownListFor(x=>x.CategoryId,new SelectList(Model.Categories,"Id", "CategoryName"))
<div class="form-group">
@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control", placeholder="Adres email" } }) <input type="submit" value="Zgłoś"/>
</div> }
</div>
<div class="form-AddQuestion__btn">
@Html.DropDownListFor(x=>x.CategoryId,new SelectList(Model.Categories,"Id", "CategoryName"), new { @class = "form-control" })
<input type="submit" value="Dodaj zapytanie"/>
</div>
</div>
}

View File

@ -1,36 +1,18 @@
@model Forum.DataAccessLayer.Models.Category @model Forum.DataAccessLayer.Models.Category
@{ @{
ViewBag.Title = Model.CategoryName; ViewBag.Title = Model.CategoryName;
} }
<h2>@Model.CategoryName</h2>
<div class="single-category-wrapper">
@Html.ActionLink("Dodaj pytanie", "AddQuestion", "Home",new {category=Model.CategoryName},null)
<h2>@Model.CategoryName</h2>
<ul>
<hr style="border-top: 1px solid #d3d3d3" /> @{
foreach (var question in Model.Questions)
<ul class="single-category__topic"> {
@{ <li>@Html.ActionLink(question.Title,"Question","Home",new{id=question.Id},null)</li>
foreach (var question in Model.Questions) }
{ }
string title = question.Title; </ul>
if (String.IsNullOrEmpty(title))
{
title = "Brak tytułu pytania";
}
<li>@Html.ActionLink(title, "Question", "Home", new { id = question.Id }, null)</li>
}
}
</ul>
<button class="add-topic">
@Html.ActionLink("Dodaj zapytanie", "AddQuestion", "Home", new { category = Model.CategoryName }, null)
</button>
</div>

View File

@ -1,19 +1,18 @@
@model IEnumerable<Forum.DataAccessLayer.Models.Category> @model IEnumerable<Forum.DataAccessLayer.Models.Category>
@{ @{
ViewBag.Title = "Strona Główna"; ViewBag.Title = "Strona Główna";
} }
<div class="category-list-wrapper">
<ul class="category-list"> <ul>
@{ @{
foreach (var category in Model) foreach (var category in Model)
{ {
<li> <li>
@Html.ActionLink(category.CategoryName, "Category", "Home", new { name = category.CategoryName }, null) @Html.ActionLink(category.CategoryName,"Category","Home",new{name=category.CategoryName},null)
</li> </li>
}
} }
} </ul>
</ul>
</div>

View File

@ -1,65 +1,28 @@
@using WebGrease.Css.Extensions @model Forum.DataAccessLayer.Models.Question
@model Forum.DataAccessLayer.Models.Question
@{
@{ ViewBag.Title = @Model.Title;
ViewBag.Title = @Model.Title; }
}
@Model.PostDate
<div class="answer-list__question"> <h2>@Model.Title</h2>
<div>
<div class="answer-list__info"> @Model.Content
<h2>@Model.Title</h2> </div>
@Model.PostDate
<hr/>
</div> @Html.ActionLink("Dodaj odpowiedź","AddAnswer",new{id=@Model.Id})
<hr style="border-top: 1px solid #d3d3d3" /> <hr/>
<b>Odpowiedzi</b>
<div class="answer-list__question__content"> <ul>
@Model.Content @{
</div> foreach (var answer in Model.Answers)
{
</div> <li>@answer.Nick @answer.Date @answer.Content </li>
}
}
<h3 class="answer-list__heading">Odpowiedzi</h3> </ul>
<ul class="answer-list__answer">
@{
foreach (var answer in Model.Answers)
{
<li class="answer-list__single-answer">
<div class="answer-list__answer__info" @{if (answer.Professional != null) { <text> style="background-color: #7ecc2a" </text> }}>
@{
if (answer.Professional != null)
{
<span class="username">@answer.Professional.FullName napisał(a)</span>
}
else
{
<span class="username">@answer.Nick napisał(a)</span>
}
}
@{
if (User.Identity.IsAuthenticated)
{
@Html.ActionLink("Usuń odpowiedź", "DeleteAnswer", new {id = answer.Id},new{@style="color:#fff;"});
}
}
@answer.Date
</div>
<div class="answer-list__content">
@answer.Content
</div>
</li>
}
}
</ul>
<div class="answer-list__add-btn">
@Html.ActionLink("Dodaj odpowiedź", "AddAnswer", new { id = @Model.Id })
</div>

View File

@ -9,7 +9,7 @@
</head> </head>
<body> <body>
<div class="navbar navbar-fixed-top"> <div class="navbar navbar-inverse navbar-fixed-top">
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
@ -17,14 +17,13 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
@Html.ActionLink("FORUM", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div> </div>
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
@if (User.Identity.IsAuthenticated) <li>@Html.ActionLink("Home", "Index", "Home")</li>
{ <li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Zarządzaj kategoriami", "Index", "Categories")</li> <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
}
</ul> </ul>
@Html.Partial("_LoginPartial") @Html.Partial("_LoginPartial")
</div> </div>
@ -34,7 +33,7 @@
@RenderBody() @RenderBody()
<hr /> <hr />
<footer> <footer>
<p>&copy; @DateTime.Now.Year - Grupa 1CF Inżynieria oprogramowania</p> <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p>
</footer> </footer>
</div> </div>

View File

@ -7,16 +7,16 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
@Html.ActionLink("Witaj " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" }) @Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
</li> </li>
<li>@Html.ActionLink("Dodaj profesjonalistę", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li> <li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li>
<li><a href="javascript:document.getElementById('logoutForm').submit()">Wyloguj się</a></li>
</ul> </ul>
} }
} }
else else
{ {
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li>@Html.ActionLink("Zaloguj się", "Login", "Account", routeValues: null, htmlAttributes: new {id = "loginLink"})</li> <li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
<li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
</ul> </ul>
} }

View File

@ -9,10 +9,9 @@
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections> </configSections>
<connectionStrings> <connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\ForumInzyneria1.mdf;Initial Catalog=ForumInzyneria1;Integrated Security=True" providerName="System.Data.SqlClient" /> <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\ForumInzyneria.mdf;Initial Catalog=ForumInzyneria;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<add key="MailSenderAddress" value="http://mailsender-inzynieria1.azurewebsites.net/Home/Index" />
<add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" /> <add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" /> <add key="ClientValidationEnabled" value="true" />
@ -87,7 +86,7 @@
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" /> <bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>

View File

@ -3,8 +3,6 @@
<package id="Antlr" version="3.5.0.2" targetFramework="net461" /> <package id="Antlr" version="3.5.0.2" targetFramework="net461" />
<package id="bootstrap" version="3.3.7" targetFramework="net461" /> <package id="bootstrap" version="3.3.7" targetFramework="net461" />
<package id="EntityFramework" version="6.2.0" targetFramework="net461" /> <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
<package id="Fluentx" version="2.0.4" targetFramework="net461" />
<package id="Fluentx.Mvc" version="1.0.4" targetFramework="net461" />
<package id="jQuery" version="3.3.1" targetFramework="net461" /> <package id="jQuery" version="3.3.1" targetFramework="net461" />
<package id="jQuery.Validation" version="1.17.0" targetFramework="net461" /> <package id="jQuery.Validation" version="1.17.0" targetFramework="net461" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.2" targetFramework="net461" /> <package id="Microsoft.AspNet.Identity.Core" version="2.2.2" targetFramework="net461" />

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MailDTO
{
public class MailDTO
{
public string Subject { get; set; }
public string EMailTo { get; set; }
public string Content { get; set; }
}
}

View File

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{07B5BD11-726F-4506-9FD8-783880AAE0EF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MailDTO</RootNamespace>
<AssemblyName>MailDTO</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MailDTO.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MailDTO")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MailDTO")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("07b5bd11-726f-4506-9fd8-783880aae0ef")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

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

View File

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

View File

@ -1,4 +1,8 @@
using System.Web.Mvc; using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing; using System.Web.Routing;
namespace MailSender namespace MailSender

View File

@ -1,5 +1,5 @@
body { body {
padding-top: 15rem; padding-top: 50px;
padding-bottom: 20px; padding-bottom: 20px;
} }
@ -18,372 +18,7 @@
/* Set width on the form input elements since they're 100% wide by default */ /* Set width on the form input elements since they're 100% wide by default */
input, input,
select { select,
textarea {
max-width: 280px; max-width: 280px;
} }
.navbar {
background: linear-gradient(#47478f 15%,#4d4794);
height: auto;
}
.navbar a {
color: #fafafa;
}
h2 {
margin: 1rem 0;
}
.navbar-toggle .icon-bar {
background: #b7c5d8;
width: 28px;
}
.navbar-brand {
font-size: 2.5rem;
font-weight: 700;
height: 70px;
line-height: 4rem;
}
.navbar-toggle {
margin-top: 18px;
}
.navbar > .container {
width: 90%;
}
.nav > li > a:hover, .nav > li > a:focus {
background-color: #5a5aa7;
}
.category-list-wrapper {
width: 80%;
margin: 0 auto;
}
.category-wrapper > ul {
list-style: none;
}
.category-list {
display: grid;
padding: 0;
grid-row-gap: 2rem;
}
.category-list > li {
height: 9rem;
display: flex;
justify-content: center;
align-items: center;
background-color: #bbbbc5;
border-radius: 1rem;
position: relative;
}
.category-list > li > a {
text-decoration: none;
color: #fafafa;
font-size: 3rem;
display: block;
width: 100%;
height: 100%;
text-align: center;
line-height: 9rem;
overflow: hidden;
}
.single-category-wrapper {
padding: 3rem;
background-color: #f2f2f2;
border-radius: 1rem;
}
.single-category-wrapper > h2 {
margin: 1rem 0;
}
.single-category-wrapper > ul {
padding: 0;
list-style: none;
}
.single-category-wrapper > ul li {
padding: 1.5rem 0;
font-size: 1.5rem;
}
.single-category-wrapper > ul li a {
text-decoration: none;
color: #3b3b3b;
}
.add-topic {
width: 100%;
border: none;
background: #79bd9b;
padding: 10px;
border-radius: 1rem;
font-size: 1.8rem;
margin-top: 1rem;
}
.add-topic > a {
color: #fafafa;
text-decoration: none;
display: block;
width: 100%;
height: 100%;
}
.form-AddQuestion {
background-color: #f1f1f3;
padding: 3rem;
border-radius: 1rem;
}
.form-AddQuestion input {
max-width: none;
}
.form-personal-data {
display: flex;
flex-direction: column;
width: 100%;
justify-content: space-between;
}
.form-personal-data .form-group {
width: 100%;
}
.form-AddQuestion input[type=submit], .add-answer input[type=submit] {
border: none;
background: #79bd9b;
padding: 10px;
border-radius: 1rem;
font-size: 1.8rem;
color: #fafafa;
}
.form-AddQuestion input[type=submit] {
margin-top: 1.7rem;
}
.form-AddQuestion__btn {
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
.textarea-wrapper {
width: 50%;
margin: 20px auto;
padding: 5px; /*workaround for textarea margin*/
background: #FFF;
border: 1px solid #808080;
}
textarea {
max-width: none;
width: 100%;
}
.answer-list__question {
background: #dee0eb;
padding: 3rem;
overflow-wrap: break-word;
border-radius: 1rem;
margin-bottom: 5rem;
}
.answer-list__question h2 {
margin: 0;
width: 80%;
}
.answer-list__info {
display: flex;
justify-content: space-between;
align-items: center;
}
.answer-list__answer {
list-style: none;
padding: 0;
}
.username {
font-weight: 700;
}
.answer-list__answer__info {
background: #4d4c4c;
color: #fafafa;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
border-radius: 1rem;
}
.answer-list__answer__info--proffesional {
background: #c68585;
}
.answer-list__single-answer {
border: 1px solid #c0bebe;
border-radius: 1rem;
margin-bottom: 3rem;
border-top: none;
}
.answer-list__content {
padding: 2rem 2rem;
width: 100%;
overflow-wrap: break-word;
}
.answer-list__heading {
margin: 2rem 0;
}
.answer-list__add-btn {
border: none;
background: #79bd9b;
border-radius: 1rem;
font-size: 1.8rem;
color: #fafafa;
width: 20rem;
display: flex;
justify-content: center;
align-items: center;
height: 5rem;
}
.answer-list__add-btn a {
text-decoration: none;
display: block;
width: 100%;
height: 100%;
color: white;
text-align: center;
line-height: 5rem;
}
.add-answer {
background: #f2f2f2;
padding: 3rem;
border-radius: 1rem;
}
.form-group--mailContent
{
width:35%;
}
.form-control--input
{
width: 280px;
height: 200px;
}
.w100 {
width: 100% !important;
max-width: 100% !important;
}
.form-emailsend
{
color: black;
width: 500px;
}
.answer-list__add-btn--sendButton
{
/*margin-left: 18%;*/
width:7%;
}
#exampleFormControlTextarea3
{
width: 280px;
}
@media (min-width: 768px) {
.navbar > .container {
height: 10rem;
}
.navbar-header {
height: 100%;
display: flex;
align-items: center;
}
.navbar-brand {
font-size: 3.5rem;
}
.navbar-nav {
height: 100px;
display: flex;
align-items: center;
}
.navbar-nav > li {
height: 50%;
}
.navbar-nav > li > a {
height: 100%;
border-radius: 0.8rem;
}
.nav > li > a:hover, .nav > li > a:focus {
transition: background-color .1s ease;
}
.category-list {
/*grid-template-columns: 1fr 1fr;*/
grid-column-gap: 2rem;
}
.single-category-wrapper {
width: 65%;
margin: 0 auto;
}
.form-AddQuestion__btn {
flex-direction: row;
margin-top: 1rem;
}
.form-personal-data {
flex-direction: row;
}
.form-personal-data .form-group {
width: 49%;
}
.form-AddQuestion input[type=submit] {
margin-top: 0;
}
}

View File

@ -1,21 +0,0 @@
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,59 +1,45 @@
using System.Net.Mail; using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
using System.Net; using System.Net;
using System.Web.Mvc; using System.Web.Mvc;
using System.Web.ModelBinding; using System.Web.Helpers;
using System; using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Configuration;
namespace MailSender.Controllers namespace MailSender.Controllers
{ {
[RoutePrefix("")]
public class HomeController : Controller public class HomeController : Controller
{ {
[HttpPost]
public ActionResult Index([System.Web.Http.FromBody]MailDTO.MailDTO mail)
{
var model = new Models.MailModel(mail);
TempData.Add("mailMod", model);
return View(model);
}
[HttpGet] [HttpGet]
public ActionResult Index() public ActionResult Index()
{ {
if(TempData["mailMod"] != null)
{
return View(TempData["mailMod"]);
}
return View(new Models.MailModel()); return View(new Models.MailModel());
} }
[System.Web.Http.HttpGet] [HttpGet]
public ActionResult Error(string errMsg) public ActionResult Error(string errMsg)
{ {
TempData.Add("errMsg", errMsg); ViewData.Add("errMsg", errMsg);
return RedirectToAction("Index"); return View();
} }
[System.Web.Mvc.HttpPost] [HttpPost]
public ActionResult Send(MailSender.Models.MailModel model) public ActionResult Index(MailSender.Models.MailModel model)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
var smtpClient = new SmtpClient(ConfigurationManager.AppSettings["smtp-server"], var smtpClient = new SmtpClient(Settings.smtpServer, Settings.smtpPort)
Int32.Parse(ConfigurationManager.AppSettings["smtp-port"]))
{ {
Credentials = new NetworkCredential( Credentials = new NetworkCredential(Settings.user, Settings.pass),
ConfigurationManager.AppSettings["user-mail"],
ConfigurationManager.AppSettings["pass-mail"]),
EnableSsl = true EnableSsl = true
}; };
smtpClient.Send(ConfigurationManager.AppSettings["user-mail"], model.EMailTo, model.Subject, model.Content); smtpClient.Send(Settings.user, model.EMailTo, model.Subject, model.Content);
return Redirect(ConfigurationManager.AppSettings["forum-address"]); return RedirectToAction("Index");
} }
else else
return RedirectToAction("Error", new { errMsg = "Błąd wysyłania wiadomości e-mail." }); return RedirectToAction("Error", new { errMsg = "Error nie umiesz pisac maila menelu" });
} }
} }
} }

View File

@ -1,4 +1,8 @@
using System.Web.Mvc; using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization; using System.Web.Optimization;
using System.Web.Routing; using System.Web.Routing;

View File

@ -51,9 +51,6 @@
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Owin, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.Owin, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.4.0.0\lib\net451\Microsoft.Owin.dll</HintPath> <HintPath>..\packages\Microsoft.Owin.4.0.0\lib\net451\Microsoft.Owin.dll</HintPath>
@ -64,21 +61,12 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Web.DynamicData" /> <Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" /> <Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" /> <Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.Web.Http.Common.4.0.20126.16343\lib\net40\System.Web.Http.Common.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
@ -163,18 +151,21 @@
<Reference Include="Microsoft.AI.Web"> <Reference Include="Microsoft.AI.Web">
<HintPath>..\packages\Microsoft.ApplicationInsights.Web.2.5.1\lib\net45\Microsoft.AI.Web.dll</HintPath> <HintPath>..\packages\Microsoft.ApplicationInsights.Web.2.5.1\lib\net45\Microsoft.AI.Web.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" />
<Compile Include="App_Start\FilterConfig.cs" /> <Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" /> <Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Controllers\DefaultController.cs" />
<Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\HomeController.cs" />
<Compile Include="Global.asax.cs"> <Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon> <DependentUpon>Global.asax</DependentUpon>
</Compile> </Compile>
<Compile Include="Models\MailModel.cs" /> <Compile Include="Models\MailModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Content\bootstrap-theme.css" /> <Content Include="Content\bootstrap-theme.css" />
@ -190,8 +181,6 @@
<Content Include="ApplicationInsights.config"> <Content Include="ApplicationInsights.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<None Include="Properties\PublishProfiles\mailsender-inzynieria1 - FTP.pubxml" />
<None Include="Properties\PublishProfiles\mailsender-inzynieria1 - Web Deploy.pubxml" />
<None Include="Scripts\jquery-3.3.1.intellisense.js" /> <None Include="Scripts\jquery-3.3.1.intellisense.js" />
<Content Include="Scripts\jquery-3.3.1.js" /> <Content Include="Scripts\jquery-3.3.1.js" />
<Content Include="Scripts\jquery-3.3.1.min.js" /> <Content Include="Scripts\jquery-3.3.1.min.js" />
@ -218,7 +207,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
<Folder Include="Views\Default\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="fonts\glyphicons-halflings-regular.woff2" /> <Content Include="fonts\glyphicons-halflings-regular.woff2" />
@ -233,12 +221,6 @@
<Content Include="Scripts\jquery-3.3.1.slim.min.map" /> <Content Include="Scripts\jquery-3.3.1.slim.min.map" />
<Content Include="Scripts\jquery-3.3.1.min.map" /> <Content Include="Scripts\jquery-3.3.1.min.map" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MailDTO\MailDTO.csproj">
<Project>{07b5bd11-726f-4506-9fd8-783880aae0ef}</Project>
<Name>MailDTO</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
@ -269,7 +251,7 @@
</ProjectExtensions> </ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>Ten projekt zawiera odwołania do pakietów NuGet, których nie ma na tym komputerze. Użyj przywracania pakietów NuGet, aby je pobrać. Aby uzyskać więcej informacji, zobacz http://go.microsoft.com/fwlink/?LinkID=322105. Brakujący plik: {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" /> <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
</Target> </Target>

View File

@ -1,5 +1,9 @@
using System.ComponentModel.DataAnnotations; using System;
using MailDTO; using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace MailSender.Models namespace MailSender.Models
@ -12,34 +16,20 @@ namespace MailSender.Models
//[ForeignKey] //[ForeignKey]
//public int UserId //id usera ktory wyslal maila //public int UserId //id usera ktory wyslal maila
[Display(Name = "Temat")] [Display(Name = "Subject")]
[Required(AllowEmptyStrings = false)] [Required(AllowEmptyStrings = false)]
public string Subject { get; set; } public string Subject { get; set; }
[DataType(DataType.EmailAddress)] [DataType(DataType.EmailAddress)]
[Required(AllowEmptyStrings = false, ErrorMessage = "Musisz wprowadzić adres e-mail odbiorcy")] [Required(AllowEmptyStrings = false, ErrorMessage = "You need to type in an e-mail")]
[RegularExpression(".*@.*\\..*", ErrorMessage = "Zły format")] [RegularExpression(".*@.*\\..*", ErrorMessage = "You typed in e-mail in wrong format")]
[Display(Name = "Adres odbiorcy")] [Display(Name = "E-Mail to")]
[EmailAddress(ErrorMessage ="Zły format")]
public string EMailTo { get; set; } public string EMailTo { get; set; }
[Display(Name ="Odpowiedź")] [Required(AllowEmptyStrings = false, ErrorMessage = "You need to type in a message to send")]
[Required(AllowEmptyStrings = false, ErrorMessage = "Proszę wprowadzić odpowiedź")] [DataType(DataType.Text)]
[DataType(DataType.MultilineText)]
[StringLength(500, ErrorMessage = "Message has to have between 1 and 500 chars", MinimumLength = 1)] [StringLength(500, ErrorMessage = "Message has to have between 1 and 500 chars", MinimumLength = 1)]
public string Content { get; set; } public string Content { get; set; }
public MailModel()
{
Content = EMailTo = Subject = string.Empty;
}
public MailModel(MailDTO.MailDTO DTO)
{
this.Content = DTO.Content;
this.EMailTo = DTO.EMailTo;
this.Subject = DTO.Subject;
}
} }
} }

View File

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

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MailSender
{
public class Settings
{
public static string smtpServer = "smtp.gmail.com";
public static int smtpPort = 587;
public static string user = "ttestowy504@gmail.com";
public static string pass = "ChyzySoftware";
}
}

View File

@ -1,37 +1,35 @@
@model MailSender.Models.MailModel @model MailSender.Models.MailModel
@{ @{
//ViewBag.Title = "Mail Sender"; ViewBag.Title = "Mail Sender";
} }
<h2>Send Mail</h2>
@if (ViewData.ContainsKey("mailErr"))
@if (TempData["mailErr"] != null)
{ {
string errStr = TempData["mailErr"] as string; <h3>Error: @ViewData["mailErr"]</h3>
<h3>Error: @TempData["mailErr"]</h3>
TempData["mailErr"] = null;
} }
@using (Html.BeginForm("Send", "Home", FormMethod.Post)) @using (Html.BeginForm("Index", "Home", FormMethod.Post))
{ {
<div class="form-group"> <div class="form-group">
@Html.LabelFor(i => i.Subject, new { @class = "label-form" }) @Html.LabelFor(i => i.Subject, new { @class = "label-form" })
@Html.EditorFor(i => i.Subject, new { htmlAttributes = new { @value = Model.Subject, @class = "form-control form-emailsend w100", @placeholder = "Temat" } }) @Html.EditorFor(i => i.Subject, new { htmlAttributes = new { @class = "form-control", @placeholder = "Subject" } })
@Html.ValidationMessageFor(i => i.Subject) @Html.ValidationMessageFor(i => i.Subject)
</div> </div>
<div class="form-group"> <div class="form-group">
@Html.LabelFor(i => i.EMailTo, new { @class = "label-form" }) @Html.LabelFor(i => i.EMailTo, new { @class = "label-form" })
@Html.EditorFor(i => i.EMailTo, new { htmlAttributes = new { @value = Model.EMailTo, @class = "form-control form-emailsend w100", @placeholder = "Do" } }) @Html.EditorFor(i => i.EMailTo, new { htmlAttributes = new { @class = "form-control", @placeholder = "To" } })
@Html.ValidationMessageFor(i => i.EMailTo) @Html.ValidationMessageFor(i => i.EMailTo)
</div> </div>
<div class="form-group" > <div class="form-group">
@Html.LabelFor(i => i.Content, new { @class = "label-form" }) @Html.LabelFor(i => i.Content, new { @class = "label-form" })
@Html.EditorFor(i => i.Content, new { htmlAttributes = new { @value = Model.Content, @class = "form-control w100", @id = "exampleFormControlTextarea3", @rows=9, @placeholder = "Odpowiedź" } }) @Html.EditorFor(i => i.Content, new { htmlAttributes = new { @class = "form-control", @placeholder = "Body" } })
@Html.ValidationMessageFor(i => i.Content) @Html.ValidationMessageFor(i => i.Content)
</div> </div>
<input type="submit" value="Wyślij" class="answer-list__add-btn answer-list__add-btn--sendButton" /> <input type="submit" value="Send" />
} }
@section Scripts { @section Scripts {

View File

@ -4,12 +4,12 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Serwis Email</title> <title>@ViewBag.Title — moja aplikacja platformy ASP.NET</title>
@Styles.Render("~/Content/css") @Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr") @Scripts.Render("~/bundles/modernizr")
</head> </head>
<body> <body>
<div class="navbar navbar-fixed-top"> <div class="navbar navbar-inverse navbar-fixed-top">
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
@ -17,11 +17,13 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
@Html.ActionLink("E-mail", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) @Html.ActionLink("Nazwa aplikacji", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div> </div>
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
<ul class="nav navbar-nar"> <ul class="nav navbar-nav">
<li>@Html.ActionLink("Strona główna", "Index", "Home")</li>
<li>@Html.ActionLink("Informacje", "About", "Home")</li>
<li>@Html.ActionLink("Kontakt", "Contact", "Home")</li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -10,11 +10,6 @@
</configSections> </configSections>
<appSettings> <appSettings>
<add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Version" value="3.0.0.0" />
<add key="user-mail" value="ttestowy504@gmail.com" />
<add key="pass-mail" value="ChyzySoftware" />
<add key="smtp-port" value="587" />
<add key="smtp-server" value="smtp.gmail.com" />
<add key="forum-address" value="http://forum-inzynieria1.azurewebsites.net/home/index"/>
<add key="webpages:Enabled" value="false" /> <add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" /> <add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" />
@ -70,12 +65,13 @@
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /> <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules> </modules>
<validation validateIntegratedModeConfiguration="false" /> <validation validateIntegratedModeConfiguration="false" />
<handlers> </system.webServer>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <system.codedom>
<remove name="OPTIONSVerbHandler" /> <compilers>
<remove name="TRACEVerbHandler" /> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</handlers></system.webServer> </compilers>
</system.codedom>
<entityFramework> <entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters> <parameters>
@ -86,10 +82,4 @@
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers> </providers>
</entityFramework> </entityFramework>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
</system.codedom>
</configuration> </configuration>

View File

@ -19,8 +19,6 @@
<package id="Microsoft.AspNet.TelemetryCorrelation" version="1.0.0" targetFramework="net461" /> <package id="Microsoft.AspNet.TelemetryCorrelation" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net461" /> <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net461" />
<package id="Microsoft.AspNet.Web.Optimization.pl" version="1.1.3" targetFramework="net461" /> <package id="Microsoft.AspNet.Web.Optimization.pl" version="1.1.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebPages" version="3.2.4" targetFramework="net461" /> <package id="Microsoft.AspNet.WebPages" version="3.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebPages.pl" version="3.2.4" targetFramework="net461" /> <package id="Microsoft.AspNet.WebPages.pl" version="3.2.4" targetFramework="net461" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net461" /> <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net461" />
@ -31,6 +29,5 @@
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net461" /> <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net461" />
<package id="Owin" version="1.0" targetFramework="net461" /> <package id="Owin" version="1.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" /> <package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" />
<package id="System.Web.Http.Common" version="4.0.20126.16343" targetFramework="net461" />
<package id="WebGrease" version="1.6.0" targetFramework="net461" /> <package id="WebGrease" version="1.6.0" targetFramework="net461" />
</packages> </packages>