diff --git a/Controllers/ticketsController.cs b/Controllers/ticketsController.cs deleted file mode 100644 index 3f638de..0000000 --- a/Controllers/ticketsController.cs +++ /dev/null @@ -1,142 +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 WebApplication1.Models; - -namespace WebApplication1.Controllers -{ - public class ticketsController : Controller - { - private newswebappEntities db = new newswebappEntities(); - - // GET: tickets - public ActionResult Index() - { - if (Session["User"] != null) - { - int uid = Convert.ToInt32(Session["Userid"]); - return View(db.tickets.Where(n => n.senderid == uid)); - } - else - return RedirectToAction("Login"); - } - - // GET: tickets/Details/5 - public ActionResult Details(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - ticket ticket = db.tickets.Find(id); - if (ticket == null) - { - return HttpNotFound(); - } - return View(ticket); - } - - // GET: tickets/Create - public ActionResult Create() - { - if (Session["User"] != null) - { - return View(); - } - else - return RedirectToAction("Login"); - - } - - // POST: tickets/Create - // To protect from overposting attacks, 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,title,content,priority,senderid,status")] ticket ticket) - { - if (ModelState.IsValid) - { - ticket.senderid = Convert.ToInt32(Session["Userid"]); - ticket.status = 1; - - db.tickets.Add(ticket); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - return View(ticket); - } - - // GET: tickets/Edit/5 - public ActionResult Edit(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - ticket ticket = db.tickets.Find(id); - if (ticket == null) - { - return HttpNotFound(); - } - return View(ticket); - } - - // POST: tickets/Edit/5 - // To protect from overposting attacks, 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,title,content,priority,senderid,status")] ticket ticket) - { - if (ModelState.IsValid) - { - db.Entry(ticket).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Index"); - } - return View(ticket); - } - - // GET: tickets/Delete/5 - public ActionResult Delete(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - ticket ticket = db.tickets.Find(id); - if (ticket == null) - { - return HttpNotFound(); - } - return View(ticket); - } - - // POST: tickets/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public ActionResult DeleteConfirmed(int id) - { - ticket ticket = db.tickets.Find(id); - db.tickets.Remove(ticket); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); - } - } -} diff --git a/Models/Model1.Context.cs b/Models/Model1.Context.cs index c4289fc..f79f1ff 100644 --- a/Models/Model1.Context.cs +++ b/Models/Model1.Context.cs @@ -30,6 +30,5 @@ namespace WebApplication1.Models public virtual DbSet tags { get; set; } public virtual DbSet tickets { get; set; } public virtual DbSet users { get; set; } - public virtual DbSet responses { get; set; } } } diff --git a/Models/Model1.edmx b/Models/Model1.edmx index 2aaf1b2..4ab2a02 100644 --- a/Models/Model1.edmx +++ b/Models/Model1.edmx @@ -29,16 +29,6 @@ - - - - - - - - - - @@ -52,11 +42,10 @@ - - - - - + + + + @@ -71,7 +60,6 @@ - @@ -86,7 +74,6 @@ - @@ -125,11 +112,10 @@ - - - - - + + + + @@ -141,16 +127,6 @@ - - - - - - - - - - @@ -195,7 +171,6 @@ - @@ -215,17 +190,6 @@ - - - - - - - - - - - diff --git a/Models/Model1.edmx.diagram b/Models/Model1.edmx.diagram index 798b380..2170411 100644 --- a/Models/Model1.edmx.diagram +++ b/Models/Model1.edmx.diagram @@ -10,7 +10,6 @@ - diff --git a/Models/response.cs b/Models/response.cs deleted file mode 100644 index 652d6aa..0000000 --- a/Models/response.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated from a template. -// -// Manual changes to this file may cause unexpected behavior in your application. -// Manual changes to this file will be overwritten if the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace WebApplication1.Models -{ - using System; - using System.Collections.Generic; - - public partial class response - { - public int ID { get; set; } - public string title { get; set; } - public string content { get; set; } - public Nullable adminid { get; set; } - public Nullable ticketid { get; set; } - } -} diff --git a/Models/ticket.cs b/Models/ticket.cs index 6183030..e372bae 100644 --- a/Models/ticket.cs +++ b/Models/ticket.cs @@ -17,8 +17,7 @@ namespace WebApplication1.Models public int ID { get; set; } public string title { get; set; } public string content { get; set; } - public int priority { get; set; } - public int senderid { get; set; } - public Nullable status { get; set; } + public string priority { get; set; } + public Nullable senderid { get; set; } } } diff --git a/Views/news/Latest.cshtml b/Views/news/Latest.cshtml deleted file mode 100644 index e91bb41..0000000 --- a/Views/news/Latest.cshtml +++ /dev/null @@ -1,52 +0,0 @@ -@model IEnumerable - -

- @Html.ActionLink("Create New", "Create") -

- - - - - - - - - - -@foreach (var item in Model) { - - - - - - - - -} - -
- @Html.DisplayNameFor(model => model.title) - - @Html.DisplayNameFor(model => model.cat) - - @Html.DisplayNameFor(model => model.tag) - - @Html.DisplayNameFor(model => model.publishDate) - - @Html.DisplayNameFor(model => model.views) -
- @Html.DisplayFor(modelItem => item.title) - - - @Html.DisplayFor(modelItem => item.cat) - - @Html.DisplayFor(modelItem => item.tag) - - @Html.DisplayFor(modelItem => item.publishDate) - - @Html.DisplayFor(modelItem => item.views) - - @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/Views/tickets/Create.cshtml b/Views/tickets/Create.cshtml deleted file mode 100644 index 04ade79..0000000 --- a/Views/tickets/Create.cshtml +++ /dev/null @@ -1,55 +0,0 @@ -@model WebApplication1.Models.ticket - -@{ - ViewBag.Title = "Create"; -} - -

Create

- -@using (Html.BeginForm()) -{ - @Html.AntiForgeryToken() - -
-

ticket

-
- @Html.ValidationSummary(true, "", new { @class = "text-danger" }) -
- @Html.LabelFor(model => model.title, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.EditorFor(model => model.title, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.title, "", new { @class = "text-danger" }) -
-
- -
- @Html.LabelFor(model => model.content, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.TextAreaFor(model => model.content, new { @class = "form-control" }) - @Html.ValidationMessageFor(model => model.content, "", new { @class = "text-danger" }) -
-
- -
- @Html.LabelFor(model => model.priority, htmlAttributes: new { @class = "control-label col-md-2" }) -
- -
- -
- -
-
- -
-
-
-} - -
- @Html.ActionLink("Back to List", "Index") -
diff --git a/Views/tickets/Delete.cshtml b/Views/tickets/Delete.cshtml deleted file mode 100644 index 68ff0cb..0000000 --- a/Views/tickets/Delete.cshtml +++ /dev/null @@ -1,64 +0,0 @@ -@model WebApplication1.Models.ticket - -@{ - ViewBag.Title = "Delete"; -} - -

Delete

- -

Are you sure you want to delete this?

-
-

ticket

-
-
-
- @Html.DisplayNameFor(model => model.title) -
- -
- @Html.DisplayFor(model => model.title) -
- -
- @Html.DisplayNameFor(model => model.content) -
- -
- @Html.DisplayFor(model => model.content) -
- -
- @Html.DisplayNameFor(model => model.priority) -
- -
- @Html.DisplayFor(model => model.priority) -
- -
- @Html.DisplayNameFor(model => model.senderid) -
- -
- @Html.DisplayFor(model => model.senderid) -
- -
- @Html.DisplayNameFor(model => model.status) -
- -
- @Html.DisplayFor(model => model.status) -
- -
- - @using (Html.BeginForm()) { - @Html.AntiForgeryToken() - -
- | - @Html.ActionLink("Back to List", "Index") -
- } -
diff --git a/Views/tickets/Details.cshtml b/Views/tickets/Details.cshtml deleted file mode 100644 index 5d90b8c..0000000 --- a/Views/tickets/Details.cshtml +++ /dev/null @@ -1,58 +0,0 @@ -@model WebApplication1.Models.ticket - -@{ - ViewBag.Title = "Details"; -} - -

Details

- -
-

ticket

-
-
-
- @Html.DisplayNameFor(model => model.title) -
- -
- @Html.DisplayFor(model => model.title) -
- -
- @Html.DisplayNameFor(model => model.content) -
- -
- @Html.DisplayFor(model => model.content) -
- -
- @Html.DisplayNameFor(model => model.priority) -
- -
- @Html.DisplayFor(model => model.priority) -
- -
- @Html.DisplayNameFor(model => model.senderid) -
- -
- @Html.DisplayFor(model => model.senderid) -
- -
- @Html.DisplayNameFor(model => model.status) -
- -
- @Html.DisplayFor(model => model.status) -
- -
-
-

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

diff --git a/Views/tickets/Index.cshtml b/Views/tickets/Index.cshtml deleted file mode 100644 index c57f18e..0000000 --- a/Views/tickets/Index.cshtml +++ /dev/null @@ -1,57 +0,0 @@ -@model IEnumerable - -@{ - ViewBag.Title = "Index"; -} - -

Index

- -

- @Html.ActionLink("Create New", "Create") -

- - - - - - - - - - -@foreach (var item in Model) { - - - - - - - - -} - -
- @Html.DisplayNameFor(model => model.title) - - @Html.DisplayNameFor(model => model.content) - - @Html.DisplayNameFor(model => model.priority) - - @Html.DisplayNameFor(model => model.senderid) - - @Html.DisplayNameFor(model => model.status) -
- @Html.DisplayFor(modelItem => item.title) - - @Html.DisplayFor(modelItem => item.content) - - @Html.DisplayFor(modelItem => item.priority) - - @Html.DisplayFor(modelItem => item.senderid) - - @Html.DisplayFor(modelItem => item.status) - - @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/WebApplication1.csproj b/WebApplication1.csproj index ad105fa..c8c5b71 100644 --- a/WebApplication1.csproj +++ b/WebApplication1.csproj @@ -145,7 +145,6 @@ - Global.asax @@ -156,9 +155,6 @@ - - Model1.tt - True @@ -278,10 +274,6 @@ - - - -