Skip to content

Commit

Permalink
Working on UI and appointment creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ardalis committed Sep 5, 2013
1 parent 2e41c6f commit 72f7801
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FrontDesk.Core.Interfaces;
using FrontDesk.Core.Model.PatientAggregate;

Expand Down
115 changes: 115 additions & 0 deletions FrontDeskSolution/FrontDesk.Web/Controllers/AppointmentController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FrontDesk.Web.Models;

namespace FrontDesk.Web.Controllers
{
public class AppointmentController : Controller
{
//
// GET: /Appointment/

public ActionResult Index()
{
return View();
}

//
// GET: /Appointment/Details/5

public ActionResult Details(int id)
{
return View();
}

//
// GET: /Appointment/Create

public ActionResult Create()
{
var model = new CreateAppointmentViewModel();
model.Doctors = new SelectList(new List<SelectListItem>()
{
new SelectListItem() { Text="Doctor McDreamy", Value="Doct McDreamy" },
new SelectListItem() { Text="Doctor Smith" },
new SelectListItem() { Text="Doctor Who" },
new SelectListItem() { Text="Doctor Zhivago" }
});

return View(model);
}

//
// POST: /Appointment/Create

[HttpPost]
public ActionResult Create(FormCollection collection)
{
try
{
// TODO: Add insert logic here

return RedirectToAction("Index");
}
catch
{
return View();
}
}

//
// GET: /Appointment/Edit/5

public ActionResult Edit(int id)
{
return View();
}

//
// POST: /Appointment/Edit/5

[HttpPost]
public ActionResult Edit(int id, FormCollection collection)
{
try
{
// TODO: Add update logic here

return RedirectToAction("Index");
}
catch
{
return View();
}
}

//
// GET: /Appointment/Delete/5

public ActionResult Delete(int id)
{
return View();
}

//
// POST: /Appointment/Delete/5

[HttpPost]
public ActionResult Delete(int id, FormCollection collection)
{
try
{
// TODO: Add delete logic here

return RedirectToAction("Index");
}
catch
{
return View();
}
}
}
}
4 changes: 3 additions & 1 deletion FrontDeskSolution/FrontDesk.Web/FrontDesk.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,13 @@
<Compile Include="Areas\HelpPage\SampleGeneration\SampleDirection.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" />
<Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />
<Compile Include="Controllers\AppointmentController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ValuesController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\CreateAppointmentViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -279,10 +281,10 @@
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Views\Shared\Error.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Appointment\Create.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<Content Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Linq;
using System.Web.Mvc;

namespace FrontDesk.Web.Models
{
public class CreateAppointmentViewModel
{
public Guid PatientId { get; set; }
public Guid ClientId { get; set; }
public DateTime DateOfAppointment { get; set; }
public TimeSpan Duration { get; set; }
public Guid SelectedDoctor { get; set; }
public SelectList Doctors { get; set; }
public string Details { get; set; }
}

public class DoctorViewModel
{
public Guid DoctorId { get; set; }
public string Name { get; set; }
}
}
73 changes: 73 additions & 0 deletions FrontDeskSolution/FrontDesk.Web/Views/Appointment/Create.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@model FrontDesk.Web.Models.CreateAppointmentViewModel

@{
ViewBag.Title = "New Appointment";
}

<h2>New Appointment</h2>

@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)

<fieldset>
<div class="editor-label">
Appointment For (choose client)
</div>
<div class="editor-field">
<input type="text" value="Type Client Name To Search" />
<input type="button" value="Search" />
</div>
<div class="editor-label">
Patient / Pet Name
</div>
<div class="editor-field">
(dropdown)
</div>


<div class="editor-label">
@Html.LabelFor(model => model.DateOfAppointment)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.DateOfAppointment)
@Html.ValidationMessageFor(model => model.DateOfAppointment)
</div>

<div class="editor-label">
@Html.LabelFor(model => model.Duration)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Duration)
@Html.ValidationMessageFor(model => model.Duration)
</div>

<div class="editor-label">
@Html.LabelFor(model => model.Doctors)
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.SelectedDoctor, Model.Doctors);
@Html.ValidationMessageFor(model => model.SelectedDoctor)
</div>

<div class="editor-label">
@Html.LabelFor(model => model.Details)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Details)
@Html.ValidationMessageFor(model => model.Details)
</div>

<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}

<div>
@Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
76 changes: 34 additions & 42 deletions FrontDeskSolution/FrontDesk.Web/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
<div id="body">
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>Welcome to ASP.NET Web API!</h1>
<h2>Modify the code in this template to jump-start your ASP.NET Web API development.</h2>
</hgroup>
<p>
ASP.NET Web API allows you to expose your applications, data and services to the
web directly over HTTP.
</p>
<p>
To learn more about ASP.NET Web API visit the
<a href="http://go.microsoft.com/fwlink/?LinkID=238195" title="ASP.NET Web API Website">ASP.NET Web API Website</a>.
The page features <mark>videos, tutorials, and samples</mark> to help you get the most from ASP.NET Web API.
If you have any questions about ASP.NET Web API, visit
<a href="http://go.microsoft.com/fwlink/?LinkID=238196" title="ASP.NET Web API Forum">our forums</a>.
</p>
</div>
</section>
<section class="content-wrapper main-content clear-fix">
<h3>We suggest the following steps:</h3>
<ol class="round">
<li class="one">
<h5>Getting Started</h5>
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
a broad range of clients, including browsers and mobile devices. ASP.NET Web API
is an ideal platform for building RESTful applications on the .NET Framework.
<a href="http://go.microsoft.com/fwlink/?LinkId=245160">Learn more…</a>
</li>
<h2>Appointments</h2>
<p>Add a grid with today's appointments and pictures of the patients</p>
<table>
<tr>
<th>Check In / Out</th>
<th>Time</th>
<th>Location</th>
<th>Patient</th>
<th>Client</th>
</tr>
<tr>
<td>
<input type="button" value="Check Out" /></td>
<td>8:00 AM</td>
<td>Exam Room One</td>
<td>
<img src="" alt="Darwin" />Darwin</td>
<td>Steve Smith<br />
123 Main Street<br />
Kent, OH 44240</td>

<li class="two">
<h5>Add NuGet packages and jump-start your coding</h5>
NuGet makes it easy to install and update free libraries and tools.
<a href="http://go.microsoft.com/fwlink/?LinkId=245161">Learn more…</a>
</li>
<li class="three">
<h5>Find Web Hosting</h5>
You can easily find a web hosting company that offers the right mix of features
and price for your applications.
<a href="http://go.microsoft.com/fwlink/?LinkId=245164">Learn more…</a>
</li>
</ol>
</section>
</tr>
<tr>
<td>
<input type="button" value="Check In" /></td>
<td>9:00 AM</td>
<td>Not Arrived</td>
<td>
<img src="http://thedatafarm.com/blog/files/media/image/WindowsLiveWriter/Sampsongetsagroomingandawalkinthewoods_7F6B/handsome%20sampson_thumb.png" alt="Sampson" style="max-height:100px;"/><br />Sampson</td>
<td>Julie Lerman<br />
123 Main Street<br />
Burlington, VT 11111</td>

</tr>
</table>
</div>
6 changes: 4 additions & 2 deletions FrontDeskSolution/FrontDesk.Web/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
<div class="content-wrapper">
<div class="float-left">
<p class="site-title">
<a href="~/">ASP.NET Web API</a></p>
<a href="~/">Vet Manager</a></p>
</div>
<div class="float-right">
<nav>
<ul id="menu">
<li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
<li>@Html.ActionLink("API", "Index", "Help", new { area = "" }, null)</li>
<li>@Html.ActionLink("New Appointment", "Create", "Appointment", new { area = "" }, null)</li>
<li>@Html.ActionLink("Client/Patient Lookup", "Index", "Help", new { area = "" }, null)</li>
<li>@Html.ActionLink("Reports", "Index", "Help", new { area = "" }, null)</li>
</ul>
</nav>
</div>
Expand Down

0 comments on commit 72f7801

Please sign in to comment.