diff --git a/.gitignore b/.gitignore index b9d6bd9..d762370 100644 --- a/.gitignore +++ b/.gitignore @@ -162,8 +162,8 @@ UpgradeLog*.XML UpgradeLog*.htm # SQL Server files -App_Data/*.mdf -App_Data/*.ldf +*.mdf +*.ldf ############# ## Windows detritus diff --git a/CodeTalk.DataSource/CodeTalk.DataSource.csproj b/CodeTalk.DataSource/CodeTalk.DataSource.csproj index 63583e4..85d0dc3 100644 --- a/CodeTalk.DataSource/CodeTalk.DataSource.csproj +++ b/CodeTalk.DataSource/CodeTalk.DataSource.csproj @@ -44,6 +44,7 @@ + diff --git a/CodeTalk.DataSource/CodeTalkContext.cs b/CodeTalk.DataSource/CodeTalkContext.cs index aa44950..900ab4f 100644 --- a/CodeTalk.DataSource/CodeTalkContext.cs +++ b/CodeTalk.DataSource/CodeTalkContext.cs @@ -8,7 +8,7 @@ namespace CodeTalk.DataSource { - class CodeTalkContext: DbContext + public class CodeTalkContext: DbContext { //public CodeTalkContext() // : base("DefaultConnection") @@ -16,5 +16,6 @@ class CodeTalkContext: DbContext //} public DbSet Talks { get; set; } + public DbSet Comments { get; set; } } } diff --git a/CodeTalk.DataSource/Repositories/CommentRepository.cs b/CodeTalk.DataSource/Repositories/CommentRepository.cs new file mode 100644 index 0000000..5a5afef --- /dev/null +++ b/CodeTalk.DataSource/Repositories/CommentRepository.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CodeTalk.Domain.Contracts; +using CodeTalk.Domain.Contracts.Repositories; +using CodeTalk.Domain.Models; + +namespace CodeTalk.DataSource.Repositories +{ + public class CommentRepository : ICommentRepository + { + + private CodeTalkContext codeTalkContext; + public CommentRepository() + { + codeTalkContext = new CodeTalkContext(); + } + public IQueryable GetComments() + { + var ctx = new CodeTalkContext(); + return ctx.Comments; + } + + public bool AddComment(Domain.Models.Comment newComment) + { + codeTalkContext.Comments.Add(newComment); + codeTalkContext.SaveChanges(); + return true; + } + + + public void EditComment(Comment comment) + { + Comment serverComment = codeTalkContext.Comments.FirstOrDefault(t => t.Id == comment.Id); + serverComment.Body = comment.Body; + serverComment.DateCreated = comment.DateCreated; + serverComment.DateModified = DateTime.Now; + + codeTalkContext.SaveChanges(); + } + + public void DeleteComment(Comment comment) + { + throw new NotImplementedException(); + } + + public Domain.Models.Comment GetCommentById(int id) + { + return codeTalkContext.Comments.FirstOrDefault(t => t.Id == id); + } + } +} diff --git a/CodeTalk.DataSource/Repositories/TalkRepository.cs b/CodeTalk.DataSource/Repositories/TalkRepository.cs index c5e9550..b2da320 100644 --- a/CodeTalk.DataSource/Repositories/TalkRepository.cs +++ b/CodeTalk.DataSource/Repositories/TalkRepository.cs @@ -5,23 +5,51 @@ using System.Threading.Tasks; using CodeTalk.Domain.Contracts; using CodeTalk.Domain.Contracts.Repositories; +using CodeTalk.Domain.Models; +using System.Data.Entity; namespace CodeTalk.DataSource.Repositories { public class TalkRepository: ITalkRepository { + + private CodeTalkContext codeTalkContext; + public TalkRepository() + { + codeTalkContext = new CodeTalkContext(); + } public IQueryable GetTalks() { var ctx = new CodeTalkContext(); - return ctx.Talks; + return ctx.Talks.Include("Comments"); } public bool AddTalk(Domain.Models.Talk newTalk) { - var ctx = new CodeTalkContext(); - ctx.Talks.Add(newTalk); - ctx.SaveChanges(); + codeTalkContext.Talks.Add(newTalk); + codeTalkContext.SaveChanges(); return true; } + + + public void EditTalk(Talk talk) + { + Talk serverTalk = codeTalkContext.Talks.FirstOrDefault(t => t.Id == talk.Id); + serverTalk.Title = talk.Title; + serverTalk.Description = talk.Description; + serverTalk.DateCreated = talk.DateCreated; + serverTalk.DateModified = DateTime.Now; + codeTalkContext.SaveChanges(); + } + + public void DeleteTalk(Domain.Models.Talk talk) + { + throw new NotImplementedException(); + } + + public Domain.Models.Talk GetTalkById(int id) + { + return codeTalkContext.Talks.FirstOrDefault(t => t.Id == id); + } } } diff --git a/CodeTalk.Domain/CodeTalk.Domain.csproj b/CodeTalk.Domain/CodeTalk.Domain.csproj index 19da385..e88cd33 100644 --- a/CodeTalk.Domain/CodeTalk.Domain.csproj +++ b/CodeTalk.Domain/CodeTalk.Domain.csproj @@ -31,6 +31,7 @@ + @@ -39,7 +40,9 @@ + + diff --git a/CodeTalk.Domain/Contracts/Repositories/ICommentRepository.cs b/CodeTalk.Domain/Contracts/Repositories/ICommentRepository.cs new file mode 100644 index 0000000..2abe4ef --- /dev/null +++ b/CodeTalk.Domain/Contracts/Repositories/ICommentRepository.cs @@ -0,0 +1,19 @@ +using CodeTalk.Domain.Models; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CodeTalk.Domain.Contracts.Repositories +{ + public interface ICommentRepository + { + IQueryable GetComments(); + bool AddComment(Comment newComment); + void EditComment(Comment comment); + void DeleteComment(Comment comment); + Comment GetCommentById(int id); + } +} diff --git a/CodeTalk.Domain/Contracts/Repositories/ITalkRepository.cs b/CodeTalk.Domain/Contracts/Repositories/ITalkRepository.cs index 5e78ebd..50f692f 100644 --- a/CodeTalk.Domain/Contracts/Repositories/ITalkRepository.cs +++ b/CodeTalk.Domain/Contracts/Repositories/ITalkRepository.cs @@ -12,7 +12,8 @@ public interface ITalkRepository { IQueryable GetTalks(); bool AddTalk(Talk newTalk); - - + void EditTalk(Talk talk); + void DeleteTalk(Talk talk); + Talk GetTalkById(int id); } } diff --git a/CodeTalk.Domain/Contracts/Services/ICommentService.cs b/CodeTalk.Domain/Contracts/Services/ICommentService.cs new file mode 100644 index 0000000..14127aa --- /dev/null +++ b/CodeTalk.Domain/Contracts/Services/ICommentService.cs @@ -0,0 +1,16 @@ +using CodeTalk.Domain.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CodeTalk.Domain.Contracts.Services +{ + public interface ICommentService + { + IList GetComments(); + bool AddComment(Comment newComment); + + } +} diff --git a/CodeTalk.Domain/Models/Comment.cs b/CodeTalk.Domain/Models/Comment.cs index 09c448d..b37d475 100644 --- a/CodeTalk.Domain/Models/Comment.cs +++ b/CodeTalk.Domain/Models/Comment.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,12 +10,20 @@ namespace CodeTalk.Domain.Models public class Comment { public int Id { get; set; } + [Required] public string Body { get; set; } + [Required] + public string CommenterName { get; set; } public int TalkId { get; set; } public DateTime DateCreated { get; set; } public DateTime DateModified { get; set; } + public Comment() + { + DateCreated = DateTime.Now; + DateModified = DateTime.Now; + } } } diff --git a/CodeTalk.Domain/Models/Talk.cs b/CodeTalk.Domain/Models/Talk.cs index 879852a..8f35dd9 100644 --- a/CodeTalk.Domain/Models/Talk.cs +++ b/CodeTalk.Domain/Models/Talk.cs @@ -18,7 +18,7 @@ public Talk() public string Title { get; set; } public string Description { get; set; } - ICollection Comments { get; set; } + public ICollection Comments { get; set; } public DateTime DateCreated { get; set; } public DateTime DateModified { get; set; } diff --git a/CodeTalk.ServiceLayer/CodeTalk.ServiceLayer.csproj b/CodeTalk.ServiceLayer/CodeTalk.ServiceLayer.csproj index c53b809..ccdfa61 100644 --- a/CodeTalk.ServiceLayer/CodeTalk.ServiceLayer.csproj +++ b/CodeTalk.ServiceLayer/CodeTalk.ServiceLayer.csproj @@ -39,6 +39,7 @@ + diff --git a/CodeTalk.ServiceLayer/CommentService.cs b/CodeTalk.ServiceLayer/CommentService.cs new file mode 100644 index 0000000..9f1c87d --- /dev/null +++ b/CodeTalk.ServiceLayer/CommentService.cs @@ -0,0 +1,49 @@ +using CodeTalk.Domain.Contracts.Services; +using CodeTalk.DataSource; +using CodeTalk.DataSource.Repositories; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CodeTalk.Domain.Models; +using CodeTalk.Domain.Contracts.Repositories; + + + +namespace CodeTalk.ServiceLayer +{ + public class CommentService:ICommentService + { + + private ICommentRepository commentRepository; + //public CommentService(ICommentRepository commentRepository) + public CommentService() + { + this.commentRepository = new CommentRepository(); + } + public IList GetComments() + { + return commentRepository.GetComments().ToList(); + } + + public bool AddComment(Comment comment) + { + return commentRepository.AddComment(comment); + } + + public Comment GetCommentById(int id) + { + return commentRepository.GetCommentById(id); + } + public void EditComment(Comment comment) + { + commentRepository.EditComment(comment); + } + public void DeleteTalk(Comment comment) + { + commentRepository.DeleteComment(comment); + } + } +} diff --git a/CodeTalk.ServiceLayer/TalkService.cs b/CodeTalk.ServiceLayer/TalkService.cs index 34dc1f6..e0e4a46 100644 --- a/CodeTalk.ServiceLayer/TalkService.cs +++ b/CodeTalk.ServiceLayer/TalkService.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using CodeTalk.Domain.Models; +using CodeTalk.Domain.Contracts.Repositories; @@ -14,16 +16,38 @@ namespace CodeTalk.ServiceLayer { public class TalkService:ITalkService { - public IList GetTalks() + private ITalkRepository talkRepository; + //public TalkService(ITalkRepository talkRepository) + public TalkService() { - var repo = new TalkRepository(); - return repo.GetTalks().ToList(); + this.talkRepository = new TalkRepository(); + } + public IList GetTalks() + { + //var repo = new TalkRepository(); + return talkRepository.GetTalks().ToList(); + } + + public bool AddTalk(Talk newTalk) + { + //var repo = new TalkRepository(); + return talkRepository.AddTalk(newTalk); } - public bool AddTalk(Domain.Models.Talk newTalk) + public Talk GetTalkById(int id) + { + //var repo = new TalkRepository(); + return talkRepository.GetTalkById(id); + } + public void EditTalk(Talk talk) + { + //var repo = new TalkRepository(); + talkRepository.EditTalk(talk); + } + public void DeleteTalk(Talk talk) { - var repo = new TalkRepository(); - return repo.AddTalk(newTalk); + //var repo = new TalkRepository(); + talkRepository.DeleteTalk(talk); } } } diff --git a/CodeTalk/CodeTalk.csproj b/CodeTalk/CodeTalk.csproj index 34c9b1a..0867372 100644 --- a/CodeTalk/CodeTalk.csproj +++ b/CodeTalk/CodeTalk.csproj @@ -182,6 +182,7 @@ + @@ -304,6 +305,14 @@ + + + + + + + + diff --git a/CodeTalk/Controllers/CommentController.cs b/CodeTalk/Controllers/CommentController.cs new file mode 100644 index 0000000..c7755e1 --- /dev/null +++ b/CodeTalk/Controllers/CommentController.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; + +using CodeTalk.Domain.Models; +using CodeTalk.ServiceLayer; + +namespace CodeTalk.Controllers +{ + public class CommentController : Controller + { + // + // GET: /Talk/ + + public ActionResult Index() + { + var commentService = new CommentService(); + var comments = commentService.GetComments(); + return View(comments); + } + + + public ActionResult Insert(int id) + { + + Comment comment = new Comment() { TalkId = id }; + return View(comment); + } + + [HttpPost] + public ActionResult Insert(Comment newComment) + { + var commentService = new CommentService(); + commentService.AddComment(newComment); + + return RedirectToAction("Index"); + } + + public ActionResult Edit(int id) + { + var commentService = new CommentService(); + Comment comment = commentService.GetCommentById(id); + return View(comment); + } + [HttpPost] + public ActionResult Edit(Comment comment) + { + var commentService = new CommentService(); + commentService.EditComment(comment); + return RedirectToAction("Index"); + } + + public ActionResult Details(int id) + { + var commentService = new CommentService(); + Comment comment = commentService.GetCommentById(id); + return View(comment); + } + } +} diff --git a/CodeTalk/Controllers/HomeController.cs b/CodeTalk/Controllers/HomeController.cs index f77e954..d273802 100644 --- a/CodeTalk/Controllers/HomeController.cs +++ b/CodeTalk/Controllers/HomeController.cs @@ -1,4 +1,6 @@ -using System; +using CodeTalk.Domain.Models; +using CodeTalk.ServiceLayer; +using System; using System.Collections.Generic; using System.Linq; using System.Web; @@ -11,22 +13,40 @@ public class HomeController : Controller public ActionResult Index() { ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; - + TalkService talkService = new TalkService(); + ViewBag.Talks = talkService.GetTalks().OrderByDescending(t => t.DateCreated); return View(); } - public ActionResult About() + public ActionResult SubmitTalk() { ViewBag.Message = "Your app description page."; return View(); } + [HttpPost] + public ActionResult SubmitTalk(Talk talk) + { + var talkService = new TalkService(); + talkService.AddTalk(talk); + return RedirectToAction("Index"); + + } - public ActionResult Contact() + public ActionResult AddComment(int id) { - ViewBag.Message = "Your contact page."; - return View(); + Comment comment = new Comment() { TalkId = id }; + return View(comment); + } + + [HttpPost] + public ActionResult AddComment(Comment newComment) + { + var commentService = new CommentService(); + commentService.AddComment(newComment); + + return RedirectToAction("Index"); } } } diff --git a/CodeTalk/Controllers/TalkController.cs b/CodeTalk/Controllers/TalkController.cs index caed84f..6c5eceb 100644 --- a/CodeTalk/Controllers/TalkController.cs +++ b/CodeTalk/Controllers/TalkController.cs @@ -25,8 +25,8 @@ public ActionResult Index() public ActionResult Insert() { - var talk = new Talk(); - return View(talk); + //var talk = new Talk(); + return View(); } [HttpPost] @@ -34,9 +34,29 @@ public ActionResult Insert(Talk newTalk) { var talkService = new TalkService(); talkService.AddTalk(newTalk); - return View(); + return RedirectToAction("Index"); } + public ActionResult Edit(int id) + { + var talkService = new TalkService(); + Talk talk = talkService.GetTalkById(id); + return View(talk); + } + [HttpPost] + public ActionResult Edit(Talk talk) + { + var talkService = new TalkService(); + talkService.EditTalk(talk); + //return View(talk); + return RedirectToAction("Index"); + } + public ActionResult Details(int id) + { + var talkService = new TalkService(); + Talk talk = talkService.GetTalkById(id); + return View(talk); + } } } diff --git a/CodeTalk/Global.asax.cs b/CodeTalk/Global.asax.cs index a165149..8e510b3 100644 --- a/CodeTalk/Global.asax.cs +++ b/CodeTalk/Global.asax.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Data.Entity; using System.Linq; using System.Web; using System.Web.Http; @@ -16,6 +17,8 @@ public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { + + AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); diff --git a/CodeTalk/Views/Comment/Details.cshtml b/CodeTalk/Views/Comment/Details.cshtml new file mode 100644 index 0000000..4485764 --- /dev/null +++ b/CodeTalk/Views/Comment/Details.cshtml @@ -0,0 +1,50 @@ +@model CodeTalk.Domain.Models.Comment + +@{ + ViewBag.Title = "Details"; +} + +

Details

+ +
+ Comment + +
+ @Html.DisplayNameFor(model => model.Body) +
+
+ @Html.DisplayFor(model => model.Body) +
+ +
+ @Html.DisplayNameFor(model => model.CommenterName) +
+
+ @Html.DisplayFor(model => model.CommenterName) +
+ +
+ @Html.DisplayNameFor(model => model.TalkId) +
+
+ @Html.DisplayFor(model => model.TalkId) +
+ +
+ @Html.DisplayNameFor(model => model.DateCreated) +
+
+ @Html.DisplayFor(model => model.DateCreated) +
+ +
+ @Html.DisplayNameFor(model => model.DateModified) +
+
+ @Html.DisplayFor(model => model.DateModified) +
+
+

+ @Html.ActionLink("Edit", "Edit", new { id=Model.Id }) | + @Html.ActionLink("Back to List", "Index") +

diff --git a/CodeTalk/Views/Comment/Edit.cshtml b/CodeTalk/Views/Comment/Edit.cshtml new file mode 100644 index 0000000..1aa4a0b --- /dev/null +++ b/CodeTalk/Views/Comment/Edit.cshtml @@ -0,0 +1,70 @@ +@model CodeTalk.Domain.Models.Comment + +@{ + ViewBag.Title = "Edit"; +} + +

Edit

+ +@using (Html.BeginForm()) { + @Html.AntiForgeryToken() + @Html.ValidationSummary(true) + +
+ Comment + + @Html.HiddenFor(model => model.Id) + +
+ @Html.LabelFor(model => model.Body) +
+
+ @Html.EditorFor(model => model.Body) + @Html.ValidationMessageFor(model => model.Body) +
+ +
+ @Html.LabelFor(model => model.CommenterName) +
+
+ @Html.EditorFor(model => model.CommenterName) + @Html.ValidationMessageFor(model => model.CommenterName) +
+ +
+ @Html.LabelFor(model => model.TalkId) +
+
+ @Html.EditorFor(model => model.TalkId) + @Html.ValidationMessageFor(model => model.TalkId) +
+ +
+ @Html.LabelFor(model => model.DateCreated) +
+
+ @Html.EditorFor(model => model.DateCreated) + @Html.ValidationMessageFor(model => model.DateCreated) +
+ +
+ @Html.LabelFor(model => model.DateModified) +
+
+ @Html.EditorFor(model => model.DateModified) + @Html.ValidationMessageFor(model => model.DateModified) +
+ +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
+ +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/CodeTalk/Views/Comment/Index.cshtml b/CodeTalk/Views/Comment/Index.cshtml new file mode 100644 index 0000000..008f8e0 --- /dev/null +++ b/CodeTalk/Views/Comment/Index.cshtml @@ -0,0 +1,57 @@ +@model IEnumerable + +@{ + ViewBag.Title = "Index"; +} + +

Index

+ +

+ @Html.ActionLink("Create New", "Insert", new {id = 0}) +

+ + + + + + + + + + +@foreach (var item in Model) { + + + + + + + + +} + +
+ @Html.DisplayNameFor(model => model.Body) + + @Html.DisplayNameFor(model => model.CommenterName) + + @Html.DisplayNameFor(model => model.TalkId) + + @Html.DisplayNameFor(model => model.DateCreated) + + @Html.DisplayNameFor(model => model.DateModified) +
+ @Html.DisplayFor(modelItem => item.Body) + + @Html.DisplayFor(modelItem => item.CommenterName) + + @Html.DisplayFor(modelItem => item.TalkId) + + @Html.DisplayFor(modelItem => item.DateCreated) + + @Html.DisplayFor(modelItem => item.DateModified) + + @Html.ActionLink("Edit", "Edit", new { id=item.Id }) | + @Html.ActionLink("Details", "Details", new { id=item.Id }) | + @Html.ActionLink("Delete", "Delete", new { id=item.Id }) +
diff --git a/CodeTalk/Views/Comment/Insert.cshtml b/CodeTalk/Views/Comment/Insert.cshtml new file mode 100644 index 0000000..4953ec9 --- /dev/null +++ b/CodeTalk/Views/Comment/Insert.cshtml @@ -0,0 +1,50 @@ +@model CodeTalk.Domain.Models.Comment + +@{ + ViewBag.Title = "Insert"; +} + +

Insert

+ +@using (Html.BeginForm()) { + @Html.AntiForgeryToken() + @Html.ValidationSummary(true) + +
+ Comment + +
+ @Html.LabelFor(model => model.Body) +
+
+ @Html.EditorFor(model => model.Body) + @Html.ValidationMessageFor(model => model.Body) +
+ +
+ @Html.LabelFor(model => model.CommenterName) +
+
+ @Html.EditorFor(model => model.CommenterName) + @Html.ValidationMessageFor(model => model.CommenterName) +
+ @*@Html.HiddenFor(model => model.TalkId)*@ +
+ @Html.EditorFor(model => model.TalkId) + @Html.ValidationMessageFor(model => model.TalkId) +
+ + +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
+ +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/CodeTalk/Views/Home/AddComment.cshtml b/CodeTalk/Views/Home/AddComment.cshtml new file mode 100644 index 0000000..e370b81 --- /dev/null +++ b/CodeTalk/Views/Home/AddComment.cshtml @@ -0,0 +1,47 @@ +@model CodeTalk.Domain.Models.Comment + +@{ + ViewBag.Title = "Add your comment:"; +} + +

Add your comment:

+ +@using (Html.BeginForm()) { + @Html.AntiForgeryToken() + @Html.ValidationSummary(true) + +
+ Comment + +
+ @Html.LabelFor(model => model.Body) +
+
+ @Html.TextAreaFor(model => model.Body, new {rows="6", cols="10"})) + @Html.ValidationMessageFor(model => model.Body) +
+ +
+ @Html.LabelFor(model => model.CommenterName) +
+
+ @Html.EditorFor(model => model.CommenterName) + @Html.ValidationMessageFor(model => model.CommenterName) +
+ @Html.HiddenFor(model => model.TalkId) + + + +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
+ +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/CodeTalk/Views/Home/Index.cshtml b/CodeTalk/Views/Home/Index.cshtml index f7aa29c..3a46e5c 100644 --- a/CodeTalk/Views/Home/Index.cshtml +++ b/CodeTalk/Views/Home/Index.cshtml @@ -5,20 +5,37 @@ } -

We suggest the following:

+ + +@*

We suggest the following:

  1. Getting Started
    @@ -42,4 +59,4 @@ and price for your applications. Learn more…
  2. -
+*@ diff --git a/CodeTalk/Views/Home/SubmitTalk.cshtml b/CodeTalk/Views/Home/SubmitTalk.cshtml new file mode 100644 index 0000000..e481b61 --- /dev/null +++ b/CodeTalk/Views/Home/SubmitTalk.cshtml @@ -0,0 +1,46 @@ +@model CodeTalk.Domain.Models.Talk + +@{ + ViewBag.Title = "SubmitTalk"; +} + +

SubmitTalk

+ +@using (Html.BeginForm()) { + @Html.AntiForgeryToken() + @Html.ValidationSummary(true) + +
+ Talk + +
+ @Html.LabelFor(model => model.Title) +
+
+ @Html.EditorFor(model => model.Title) + @Html.ValidationMessageFor(model => model.Title) +
+ +
+ @Html.LabelFor(model => model.Description) +
+
+ @Html.EditorFor(model => model.Description) + @Html.ValidationMessageFor(model => model.Description) +
+ + + +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
+ +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/CodeTalk/Views/Shared/_Layout.cshtml b/CodeTalk/Views/Shared/_Layout.cshtml index 247a91f..7b165a2 100644 --- a/CodeTalk/Views/Shared/_Layout.cshtml +++ b/CodeTalk/Views/Shared/_Layout.cshtml @@ -2,7 +2,7 @@ - @ViewBag.Title - My ASP.NET MVC Application + @ViewBag.Title - Code Talk Demo @Styles.Render("~/Content/css") @@ -12,7 +12,7 @@
-

@Html.ActionLink("your logo here", "Index", "Home")

+

@Html.ActionLink("Code Talk Demo", "Index", "Home")

@@ -21,8 +21,8 @@
diff --git a/CodeTalk/Views/Talk/Details.cshtml b/CodeTalk/Views/Talk/Details.cshtml new file mode 100644 index 0000000..c9a655c --- /dev/null +++ b/CodeTalk/Views/Talk/Details.cshtml @@ -0,0 +1,43 @@ +@model CodeTalk.Domain.Models.Talk + +@{ + ViewBag.Title = "Detail"; +} + +

Detail

+ +
+ Talk + +
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+ +
+ @Html.DisplayNameFor(model => model.Description) +
+
+ @Html.DisplayFor(model => model.Description) +
+ +
+ @Html.DisplayNameFor(model => model.DateCreated) +
+
+ @Html.DisplayFor(model => model.DateCreated) +
+ +
+ @Html.DisplayNameFor(model => model.DateModified) +
+
+ @Html.DisplayFor(model => model.DateModified) +
+
+

+ @Html.ActionLink("Edit", "Edit", new { id=Model.Id }) | + @Html.ActionLink("Back to List", "Index") +

diff --git a/CodeTalk/Views/Talk/Edit.cshtml b/CodeTalk/Views/Talk/Edit.cshtml new file mode 100644 index 0000000..833f32d --- /dev/null +++ b/CodeTalk/Views/Talk/Edit.cshtml @@ -0,0 +1,60 @@ +@model CodeTalk.Domain.Models.Talk + +@{ + ViewBag.Title = "Edit"; +} + +

Edit

+ +@using (Html.BeginForm()) { + @Html.AntiForgeryToken() + @Html.ValidationSummary(true) + +
+ Talk + + @Html.HiddenFor(model => model.Id) + +
+ @Html.LabelFor(model => model.Title) +
+
+ @Html.EditorFor(model => model.Title) + @Html.ValidationMessageFor(model => model.Title) +
+ +
+ @Html.LabelFor(model => model.Description) +
+
+ @Html.EditorFor(model => model.Description) + @Html.ValidationMessageFor(model => model.Description) +
+ +
+ @Html.DisplayNameFor(model => model.DateCreated) +
+
+ @Html.DisplayFor(model => model.DateCreated) +
+ +
+ @Html.DisplayNameFor(model => model.DateModified) +
+
+ @Html.DisplayFor(model => model.DateModified) +
+ +

+ +

+
+} + +
+ @Html.ActionLink("Back to List", "Index") +
+ +@section Scripts { + @Scripts.Render("~/bundles/jqueryval") +} diff --git a/CodeTalk/Views/Talk/Insert.cshtml b/CodeTalk/Views/Talk/Insert.cshtml index a28a05b..5c701cc 100644 --- a/CodeTalk/Views/Talk/Insert.cshtml +++ b/CodeTalk/Views/Talk/Insert.cshtml @@ -29,7 +29,7 @@ @Html.ValidationMessageFor(model => model.Description)
-
+ @*
@Html.LabelFor(model => model.DateCreated)
@@ -43,7 +43,7 @@
@Html.EditorFor(model => model.DateModified) @Html.ValidationMessageFor(model => model.DateModified) -
+
*@

diff --git a/CodeTalk/Web.config b/CodeTalk/Web.config index 8c30cbc..179c6ce 100644 --- a/CodeTalk/Web.config +++ b/CodeTalk/Web.config @@ -9,7 +9,11 @@

- + + + + + @@ -76,6 +80,11 @@ - + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..af36bcb --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +CodeTalk +======== + +This is a demo app for TRINUG started by GregP