Add missing files. Add API for client apps. master
authorRafał Długołęcki <dlugolecki.rafal@gmail.com>
Sat, 13 Feb 2016 03:20:30 +0000 (04:20 +0100)
committerRafał Długołęcki <dlugolecki.rafal@gmail.com>
Sat, 13 Feb 2016 03:20:30 +0000 (04:20 +0100)
16 files changed:
1.DefaultUserRoles.sql [new file with mode: 0644]
2.DefaultUsers.sql [new file with mode: 0644]
3.DefaultTaskStatuses.sql [new file with mode: 0644]
4.DefaultProjects.sql [new file with mode: 0644]
5.DefaultProjectTasks.sql [new file with mode: 0644]
Projects/App_Start/WebApiConfig.cs [new file with mode: 0644]
Projects/Controllers/api/ActivityController.cs [new file with mode: 0644]
Projects/Controllers/api/ProjectTasksController.cs [new file with mode: 0644]
Projects/Controllers/api/ProjectsController.cs [new file with mode: 0644]
Projects/Global.asax.cs
Projects/Models/Metadata.cs
Projects/Projects.csproj
Projects/Views/Activity/Index.cshtml [new file with mode: 0644]
Projects/Views/Login/Login.cshtml [new file with mode: 0644]
Projects/Web.config
Projects/packages.config

diff --git a/1.DefaultUserRoles.sql b/1.DefaultUserRoles.sql
new file mode 100644 (file)
index 0000000..06d7171
--- /dev/null
@@ -0,0 +1 @@
+INSERT INTO dbo.UserRoles VALUES (1, 'user'), (2, 'admin');
\ No newline at end of file
diff --git a/2.DefaultUsers.sql b/2.DefaultUsers.sql
new file mode 100644 (file)
index 0000000..9823c31
--- /dev/null
@@ -0,0 +1,4 @@
+SET IDENTITY_INSERT dbo.Users ON;
+INSERT INTO dbo.Users (id, login, password, role_id)
+VALUES (1, 'user', 'user', 1), (2, 'admin', 'admin', 2);
+SET IDENTITY_INSERT dbo.Users OFF;
\ No newline at end of file
diff --git a/3.DefaultTaskStatuses.sql b/3.DefaultTaskStatuses.sql
new file mode 100644 (file)
index 0000000..ffc0803
--- /dev/null
@@ -0,0 +1,9 @@
+SET IDENTITY_INSERT dbo.TaskStatuses ON;
+INSERT INTO
+       dbo.TaskStatuses (id, status)
+VALUES
+       (1, 'Todo'),
+       (2, 'In progress'),
+       (3, 'Done')
+;
+SET IDENTITY_INSERT dbo.TaskStatuses OFF;
\ No newline at end of file
diff --git a/4.DefaultProjects.sql b/4.DefaultProjects.sql
new file mode 100644 (file)
index 0000000..bd7c924
--- /dev/null
@@ -0,0 +1,10 @@
+SET IDENTITY_INSERT dbo.Projects ON;
+INSERT INTO dbo.Projects (id, user_id, name, description, created_at, updated_at)
+VALUES
+(1, 2, 'Projekt admina', 'To jest projekt admina', '2016-02-12 00:00:00', '2016-02-12 00:00:00'),
+(2, 1, 'Projekt usera', 'To jest projekt usera', '2016-02-12 00:00:00', '2016-02-12 00:00:00'),
+(3, 1, 'Inny projekt usera', 'Prace nad projektem badawczym', '2016-02-12 00:00:00', '2016-02-12 00:00:00'),
+(4, 2, 'Kolejny projekt usera', 'Jakiś projekt Open Source', '2016-02-12 00:00:00', '2016-02-12 00:00:00'),
+(5, 2, 'Testowy projekt admina', 'Ważny projekt', '2016-02-12 00:00:00', '2016-02-12 00:00:00')
+;
+SET IDENTITY_INSERT dbo.Projects OFF;
\ No newline at end of file
diff --git a/5.DefaultProjectTasks.sql b/5.DefaultProjectTasks.sql
new file mode 100644 (file)
index 0000000..87e9ef9
--- /dev/null
@@ -0,0 +1,26 @@
+SET IDENTITY_INSERT dbo.ProjectTasks ON;
+INSERT INTO dbo.ProjectTasks (id, project_id, name, description, created_at, updated_at, task_status_id, user_id)
+VALUES
+(1, 1, 'Inicjalizacja bazy danych', 'Wymagana jest inicjalizacja bazy danych, zadanie polega na przygotowaniu struktury pod stronę', '2016-02-12 00:01:00', '2016-02-12 00:01:00', 3, 1),
+(2, 1, 'Wprowadznie treści do bazy', 'Treści będą wykorzystywane przy instalacjach aplikacji', '2016-02-12 00:05:00', '2016-02-12 00:05:00', 3, 1),
+(3, 1, 'Opracowanie testów aplikacji', 'Aplikacja ma mieć testy jednostkowe umożliwiające znalezienie błędów na wczesnym etapie prac', '2016-02-12 00:10:00', '2016-02-12 00:10:00', 1, 1),
+(4, 1, 'Przetestowanie aplikacji', 'Przed wydaniem produkcyjnym aplikacja ma być przetestowana', '2016-02-12 00:29:00', '2016-02-12 00:29:00', 1, 1),
+(5, 1, 'Stworzenie frontendu dla bazy danych', 'Kod strony pisany ma być w języku do tego ustalonym', '2016-02-12 00:35:00', '2016-02-12 00:35:00', 1, 2),
+
+
+(6, 2, 'Mockup projektu', 'Przygotowanie mockupu', '2016-02-12 00:00:00', '2016-02-12 00:00:00', 2, 1),
+(7, 2, 'Projekt graficzny', 'Przygotowanie projektu graficznego przez grafika', '2016-02-12 00:01:00', '2016-02-12 00:01:00', 1, 1),
+(8, 2, 'Akceptacja klienta', 'Akceptacja projektu graficznego przez klienta', '2016-02-12 00:05:00', '2016-02-12 00:05:00', 3, 2),
+(9, 2, 'Implementacja', 'Implementacja projektu graficznego w kod', '2016-02-12 00:10:00', '2016-02-12 00:10:00', 3, 1),
+(10, 2, 'Wdrożenie', 'Wdrożenie aplikacji u klienta', '2016-02-12 00:29:00', '2016-02-12 00:29:00', 1, 1),
+(11, 2, 'Szkolenie', 'Szkolenie klienta', '2016-02-12 00:35:00', '2016-02-12 00:35:00', 1, 2),
+
+
+
+(12, 3, 'Inny projekt usera', 'Prace nad projektem badawczym', '2016-02-12 00:00:00', '2016-02-12 00:00:00', 1, 1),
+(13, 4, 'Kolejny projekt usera', 'Jakiś projekt Open Source', '2016-02-12 00:00:00', '2016-02-12 00:00:00', 2, 1),
+(14, 5, 'Testowy projekt admina', 'Ważny projekt', '2016-02-12 00:00:00', '2016-02-12 00:00:00', 2, 2)
+
+
+;
+SET IDENTITY_INSERT dbo.ProjectTasks OFF;
\ No newline at end of file
diff --git a/Projects/App_Start/WebApiConfig.cs b/Projects/App_Start/WebApiConfig.cs
new file mode 100644 (file)
index 0000000..c05dbf3
--- /dev/null
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web.Http;
+using System.Web.Http.Filters;
+
+namespace Projects
+{
+    public static class WebApiConfig
+    {
+        public static void Register(HttpConfiguration config)
+        {
+            config.MapHttpAttributeRoutes();
+
+            config.Routes.MapHttpRoute(
+                name: "DefaultApi",
+                routeTemplate: "api/{controller}/{id}",
+                defaults: new { id = RouteParameter.Optional }
+            );
+        }
+    }
+    public class AllowCrossSiteJsonAttribute : ActionFilterAttribute
+    {
+        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
+        {
+            if (actionExecutedContext.Response != null)
+                actionExecutedContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
+
+            base.OnActionExecuted(actionExecutedContext);
+        }
+    }
+}
diff --git a/Projects/Controllers/api/ActivityController.cs b/Projects/Controllers/api/ActivityController.cs
new file mode 100644 (file)
index 0000000..0766226
--- /dev/null
@@ -0,0 +1,63 @@
+using Newtonsoft.Json;
+using Projects.Models;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Threading.Tasks;
+using System.Web.Http;
+
+namespace Projects.Controllers.api
+{
+    [AllowCrossSiteJson]
+    public class ActivityController : ApiController
+    {
+        private ProjectsDBEntities db = new ProjectsDBEntities();
+
+        // GET: api/Activity
+        public HttpResponseMessage GetActivity()
+        {
+            var results = (from pt in db.ProjectTasks
+                           join ts in db.TaskStatuses on pt.task_status_id equals ts.id
+                           where ts.status == "Done"
+                           group pt.User by pt.User.id into g
+                           join u in db.Users on g.Key equals u.id
+                           select new ActivityResult { user = u.login, count = g.Count() })
+                           .ToList();
+            return new HttpResponseMessage() {
+                Content = new JsonContent(results)
+            };
+            
+        }
+    }
+    public class JsonContent : HttpContent
+    {
+
+        private readonly MemoryStream _Stream = new MemoryStream();
+        public JsonContent(object value)
+        {
+
+            Headers.ContentType = new MediaTypeHeaderValue("application/json");
+            var jw = new JsonTextWriter(new StreamWriter(_Stream));
+            jw.Formatting = Formatting.Indented;
+            var serializer = new JsonSerializer();
+            serializer.Serialize(jw, value);
+            jw.Flush();
+            _Stream.Position = 0;
+
+        }
+        protected override Task SerializeToStreamAsync(Stream stream, TransportContext context)
+        {
+            return _Stream.CopyToAsync(stream);
+        }
+
+        protected override bool TryComputeLength(out long length)
+        {
+            length = _Stream.Length;
+            return true;
+        }
+    }
+}
diff --git a/Projects/Controllers/api/ProjectTasksController.cs b/Projects/Controllers/api/ProjectTasksController.cs
new file mode 100644 (file)
index 0000000..fd45ba2
--- /dev/null
@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
+using System.Web.Http;
+using System.Web.Http.Description;
+using Projects.Models;
+
+namespace Projects.Controllers.api
+{
+    [AllowCrossSiteJson]
+    public class ProjectTasksController : ApiController
+    {
+        private ProjectsDBEntities db = new ProjectsDBEntities();
+
+        // GET: api/ProjectTasks
+        public IQueryable<ProjectTask> GetProjectTasks()
+        {
+            db.Configuration.ProxyCreationEnabled = false;
+            db.Configuration.LazyLoadingEnabled = false;
+            return db.ProjectTasks;
+        }
+
+        // GET: api/ProjectTasks/5
+        [ResponseType(typeof(ProjectTask))]
+        public async Task<IHttpActionResult> GetProjectTask(int id)
+        {
+            ProjectTask projectTask = await db.ProjectTasks.FindAsync(id);
+            if (projectTask == null)
+            {
+                return NotFound();
+            }
+
+            return Ok(projectTask);
+        }
+
+        // PUT: api/ProjectTasks/5
+        [ResponseType(typeof(void))]
+        public async Task<IHttpActionResult> PutProjectTask(int id, ProjectTask projectTask)
+        {
+            if (!ModelState.IsValid)
+            {
+                return BadRequest(ModelState);
+            }
+
+            if (id != projectTask.id)
+            {
+                return BadRequest();
+            }
+
+            db.Entry(projectTask).State = EntityState.Modified;
+
+            try
+            {
+                await db.SaveChangesAsync();
+            }
+            catch (DbUpdateConcurrencyException)
+            {
+                if (!ProjectTaskExists(id))
+                {
+                    return NotFound();
+                }
+                else
+                {
+                    throw;
+                }
+            }
+
+            return StatusCode(HttpStatusCode.NoContent);
+        }
+
+        // POST: api/ProjectTasks
+        [ResponseType(typeof(ProjectTask))]
+        public async Task<IHttpActionResult> PostProjectTask(ProjectTask projectTask)
+        {
+            if (!ModelState.IsValid)
+            {
+                return BadRequest(ModelState);
+            }
+
+            db.ProjectTasks.Add(projectTask);
+            await db.SaveChangesAsync();
+
+            return CreatedAtRoute("DefaultApi", new { id = projectTask.id }, projectTask);
+        }
+
+        // DELETE: api/ProjectTasks/5
+        [ResponseType(typeof(ProjectTask))]
+        public async Task<IHttpActionResult> DeleteProjectTask(int id)
+        {
+            ProjectTask projectTask = await db.ProjectTasks.FindAsync(id);
+            if (projectTask == null)
+            {
+                return NotFound();
+            }
+
+            db.ProjectTasks.Remove(projectTask);
+            await db.SaveChangesAsync();
+
+            return Ok(projectTask);
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                db.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        private bool ProjectTaskExists(int id)
+        {
+            return db.ProjectTasks.Count(e => e.id == id) > 0;
+        }
+    }
+}
\ No newline at end of file
diff --git a/Projects/Controllers/api/ProjectsController.cs b/Projects/Controllers/api/ProjectsController.cs
new file mode 100644 (file)
index 0000000..b1b3406
--- /dev/null
@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
+using System.Web.Http;
+using System.Web.Http.Description;
+using Projects.Models;
+
+namespace Projects.Controllers.api
+{
+    [AllowCrossSiteJson]
+    public class ProjectsController : ApiController
+    {
+        private ProjectsDBEntities db = new ProjectsDBEntities();
+
+        // GET: api/Projects
+        public IQueryable<Project> GetProjects()
+        {
+            db.Configuration.ProxyCreationEnabled = false;
+            db.Configuration.LazyLoadingEnabled = false;
+            return db.Projects;
+        }
+
+        // GET: api/Projects/5
+        [ResponseType(typeof(Project))]
+        public async Task<IHttpActionResult> GetProject(int id)
+        {
+            Project project = await db.Projects.FindAsync(id);
+            if (project == null)
+            {
+                return NotFound();
+            }
+
+            return Ok(project);
+        }
+
+        // PUT: api/Projects/5
+        [ResponseType(typeof(void))]
+        public async Task<IHttpActionResult> PutProject(int id, Project project)
+        {
+            if (!ModelState.IsValid)
+            {
+                return BadRequest(ModelState);
+            }
+
+            if (id != project.id)
+            {
+                return BadRequest();
+            }
+
+            db.Entry(project).State = EntityState.Modified;
+
+            try
+            {
+                await db.SaveChangesAsync();
+            }
+            catch (DbUpdateConcurrencyException)
+            {
+                if (!ProjectExists(id))
+                {
+                    return NotFound();
+                }
+                else
+                {
+                    throw;
+                }
+            }
+
+            return StatusCode(HttpStatusCode.NoContent);
+        }
+
+        // POST: api/Projects
+        [ResponseType(typeof(Project))]
+        public async Task<IHttpActionResult> PostProject(Project project)
+        {
+            if (!ModelState.IsValid)
+            {
+                return BadRequest(ModelState);
+            }
+
+            db.Projects.Add(project);
+            await db.SaveChangesAsync();
+
+            return CreatedAtRoute("DefaultApi", new { id = project.id }, project);
+        }
+
+        // DELETE: api/Projects/5
+        [ResponseType(typeof(Project))]
+        public async Task<IHttpActionResult> DeleteProject(int id)
+        {
+            Project project = await db.Projects.FindAsync(id);
+            if (project == null)
+            {
+                return NotFound();
+            }
+
+            db.Projects.Remove(project);
+            await db.SaveChangesAsync();
+
+            return Ok(project);
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                db.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        private bool ProjectExists(int id)
+        {
+            return db.Projects.Count(e => e.id == id) > 0;
+        }
+    }
+}
\ No newline at end of file
index 61f3d92a52d4f617ae55b7c36d3778483129c455..bb16001f1c4f49f64e70eb460cefd49f90c3c80b 100644 (file)
@@ -7,6 +7,8 @@ using System.Web.Mvc;
 using System.Web.Optimization;
 using System.Web.Routing;
 using System.Web.Security;
+using System.Web.Http;
+using System.Web.Routing;
 
 namespace Projects
 {
@@ -14,10 +16,21 @@ namespace Projects
     {
         protected void Application_Start()
         {
+            GlobalConfiguration.Configure(WebApiConfig.Register);
+
             AreaRegistration.RegisterAllAreas();
             FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
             RouteConfig.RegisterRoutes(RouteTable.Routes);
             BundleConfig.RegisterBundles(BundleTable.Bundles);
+
+            var formatters = GlobalConfiguration.Configuration.Formatters;
+            formatters.Remove(formatters.XmlFormatter);
+
+            /* JSON formatting */
+            var json = formatters.JsonFormatter;
+            json.SerializerSettings.PreserveReferencesHandling  = Newtonsoft.Json.PreserveReferencesHandling.None;
+            json.SerializerSettings.ReferenceLoopHandling       = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
+            json.SerializerSettings.Formatting                  = Newtonsoft.Json.Formatting.Indented;
         }
 
         protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
index a5bac9cff26daed96b733f02dfc61d696be92c1c..ed7b886b727bc1d5f873dc564d7aa5152c3933ee 100644 (file)
@@ -1,8 +1,11 @@
-using System;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 
 namespace Projects.Models
 {
+    [JsonObject(IsReference = true)]
     public class ProjectMetadata
     {
         [StringLength(50)]
@@ -22,6 +25,7 @@ namespace Projects.Models
         public Nullable<int> user_id;
     }
 
+    [JsonObject(IsReference = true)]
     public class ProjectTaskMetadata
     {
         [StringLength(50)]
@@ -41,6 +45,7 @@ namespace Projects.Models
         public Nullable<int> user_id;
     }
 
+    [JsonObject(IsReference = true)]
     public class UserMetadata
     {
         [Display(Name = "Nazwa użytkownika")]
@@ -50,6 +55,7 @@ namespace Projects.Models
         public string password;
     }
 
+    [JsonObject(IsReference = true)]
     public class TaskStatusMetadata
     {
         [Display(Name = "Status")]
index 08f2500b5cab2b3cdaa7d96c18659c586657a723..ca57e871b1bfa8c685e43b257657bcf936e7e11e 100644 (file)
       <Private>True</Private>
     </Reference>
     <Reference Include="Microsoft.CSharp" />
+    <Reference Include="Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <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>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Security" />
+    <Reference Include="System.Spatial, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="System.Web.DynamicData" />
     <Reference Include="System.Web.Entity" />
     <Reference Include="System.Web.ApplicationServices" />
     <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Core" />
     <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>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Web.Http.OData, Version=5.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.OData.5.3.1\lib\net45\System.Web.Http.OData.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web.Extensions" />
     <Compile Include="App_Start\BundleConfig.cs" />
     <Compile Include="App_Start\FilterConfig.cs" />
     <Compile Include="App_Start\RouteConfig.cs" />
+    <Compile Include="App_Start\WebApiConfig.cs" />
     <Compile Include="Controllers\ActivityController.cs" />
     <Compile Include="Controllers\ActivityResult.cs" />
+    <Compile Include="Controllers\api\ActivityController.cs" />
+    <Compile Include="Controllers\api\ProjectsController.cs" />
+    <Compile Include="Controllers\api\ProjectTasksController.cs" />
     <Compile Include="Controllers\HomeController.cs" />
     <Compile Include="Controllers\LoginController.cs" />
     <Compile Include="Controllers\ProjectTasksController.cs" />
diff --git a/Projects/Views/Activity/Index.cshtml b/Projects/Views/Activity/Index.cshtml
new file mode 100644 (file)
index 0000000..b5e121c
--- /dev/null
@@ -0,0 +1,24 @@
+
+@{
+    ViewBag.Title = "Aktywność użytkowników";
+}
+
+<h2>@ViewBag.Title</h2>
+
+
+
+<table class="table">
+    <tr>
+        <th>Nazwa użytkownika</th>
+        <th>Ilość ukończonych zadań</th>
+    </tr>
+    @foreach (var result in (IEnumerable<ActivityResult>)ViewBag.results)
+    {
+        <tr>
+            <td>@result.user</td>
+            <td>@result.count</td>
+        </tr>
+    }
+
+</table>
+
diff --git a/Projects/Views/Login/Login.cshtml b/Projects/Views/Login/Login.cshtml
new file mode 100644 (file)
index 0000000..98481b0
--- /dev/null
@@ -0,0 +1,37 @@
+@model Projects.Models.User
+
+@{
+    ViewBag.Title = "Login";
+}
+
+<h2>@ViewBag.Title</h2>
+
+<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
+<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
+
+@using (Html.BeginForm())
+{
+    @Html.AntiForgeryToken()
+
+    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
+    <div class="form-group">
+        @Html.LabelFor(model => model.login, htmlAttributes: new { @class = "control-label col-md-2" })
+        <div class="col-md-10">
+            @Html.EditorFor(model => model.login, new { htmlAttributes = new { @class = "form-control" } })
+            @Html.ValidationMessageFor(model => model.login, "", new { @class = "text-danger" })
+        </div>
+    </div>
+    <div class="form-group">
+        @Html.LabelFor(model => model.password, htmlAttributes: new { @class = "control-label col-md-2" })
+        <div class="col-md-10">
+            @Html.EditorFor(model => model.password, new { htmlAttributes = new { @class = "form-control" } })
+            @Html.ValidationMessageFor(model => model.password, "", new { @class = "text-danger" })
+        </div>
+    </div>
+
+    <div class="form-group">
+        <div class="col-md-offset-2 col-md-10">
+            <input type="submit" value="Zaloguj się" class="btn btn-default" />
+        </div>
+    </div>
+}
\ No newline at end of file
index 06973afa683f0bbba7836d05a22ba02b25420aa9..97b0fb83e1f09a60b04469c948e8a51dd039a63b 100644 (file)
       <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
     </modules>
     <validation validateIntegratedModeConfiguration="false" />
-  </system.webServer>
+  <handlers>
+      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
+      <remove name="OPTIONSVerbHandler" />
+      <remove name="TRACEVerbHandler" />
+      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
+    </handlers></system.webServer>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
         <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
       </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
+      </dependentAssembly>
     </assemblyBinding>
   </runtime>
   <entityFramework>
index c5985961205069b113d93f6f4cdf7f68bbbe26cd..f6ce9247d686b54b1509d6a24434d7bb7c51fc11 100644 (file)
   <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
   <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
   <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.OData" version="5.3.1" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
   <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
+  <package id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net452" />
+  <package id="Microsoft.Data.OData" version="5.6.0" targetFramework="net452" />
   <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net452" />
   <package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
   <package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
@@ -37,5 +44,6 @@
   <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
   <package id="Owin" version="1.0" targetFramework="net452" />
   <package id="Respond" version="1.2.0" targetFramework="net452" />
+  <package id="System.Spatial" version="5.6.0" targetFramework="net452" />
   <package id="WebGrease" version="1.5.2" targetFramework="net452" />
 </packages>
\ No newline at end of file