Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ArpitDave_007/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\Scoreboard\Scoreboard\bin\
\Scoreboard\.vs\
10 changes: 10 additions & 0 deletions ArpitDave_007/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 30MinTask - Submission : Arpit Dave

Netlify link : http://arpitdave2.netlify.com

Commit 1 : The web page consists of a design for grid for the game - Tic Tac Toe using HTML and CSS.
As per the instructions, CSS file was supposed to be separate.

Commit 2 : Completed TicTacToe functionality for a two player game. Score board UI implemented. Backend integration required.

Commit 3 : Backend integrated. Bugs present - Score not being updated
Binary file added ArpitDave_007/Scoreboard/.vs/Scoreboard/v14/.suo
Binary file not shown.
1,027 changes: 1,027 additions & 0 deletions ArpitDave_007/Scoreboard/.vs/config/applicationhost.config

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions ArpitDave_007/Scoreboard/Scoreboard.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 14 for Web
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scoreboard", "Scoreboard\Scoreboard.csproj", "{DBA0CEB1-41BE-4173-A753-BA32EE02A86B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DBA0CEB1-41BE-4173-A753-BA32EE02A86B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DBA0CEB1-41BE-4173-A753-BA32EE02A86B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DBA0CEB1-41BE-4173-A753-BA32EE02A86B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DBA0CEB1-41BE-4173-A753-BA32EE02A86B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
24 changes: 24 additions & 0 deletions ArpitDave_007/Scoreboard/Scoreboard/App_Start/WebApiConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.Http.Cors;

namespace Scoreboard
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
var cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);
config.MapHttpAttributeRoutes();

config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
133 changes: 133 additions & 0 deletions ArpitDave_007/Scoreboard/Scoreboard/Controllers/ScoresController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
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.Web.Http;
using System.Web.Http.Description;
using Scoreboard.Models;

namespace Scoreboard.Controllers
{
public class ScoresController : ApiController
{
private ScoreboardEntities db = new ScoreboardEntities();

// GET: api/Scores
public IQueryable<Score> GetScores()
{
return db.Scores;
}

// GET: api/Scores/5
[ResponseType(typeof(Score))]
public IHttpActionResult GetScore(string id)
{
Score score = db.Scores.Find(id);
if (score == null)
{
return NotFound();
}

return Ok(score);
}

// PUT: api/Scores/5
[ResponseType(typeof(void))]
public IHttpActionResult PutScore(string id, Score score)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}

if (id != score.Name)
{
return BadRequest();
}

db.Entry(score).State = EntityState.Modified;

try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException)
{
if (!ScoreExists(id))
{
return NotFound();
}
else
{
throw;
}
}

return StatusCode(HttpStatusCode.NoContent);
}

// POST: api/Scores
[ResponseType(typeof(Score))]
public IHttpActionResult PostScore(Score score)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}

db.Scores.Add(score);

try
{
db.SaveChanges();
}
catch (DbUpdateException)
{
if (ScoreExists(score.Name))
{
return Conflict();
}
else
{
throw;
}
}

return CreatedAtRoute("DefaultApi", new { id = score.Name }, score);
}

// DELETE: api/Scores/5
[ResponseType(typeof(Score))]
public IHttpActionResult DeleteScore(string id)
{
Score score = db.Scores.Find(id);
if (score == null)
{
return NotFound();
}

db.Scores.Remove(score);
db.SaveChanges();

return Ok(score);
}

protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}

private bool ScoreExists(string id)
{
return db.Scores.Count(e => e.Name == id) > 0;
}
}
}
1 change: 1 addition & 0 deletions ArpitDave_007/Scoreboard/Scoreboard/Global.asax
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="Scoreboard.WebApiApplication" Language="C#" %>
17 changes: 17 additions & 0 deletions ArpitDave_007/Scoreboard/Scoreboard/Global.asax.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Routing;

namespace Scoreboard
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
}
}
}
30 changes: 30 additions & 0 deletions ArpitDave_007/Scoreboard/Scoreboard/Models/Score.Context.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Scoreboard.Models
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;

public partial class ScoreboardEntities : DbContext
{
public ScoreboardEntities()
: base("name=ScoreboardEntities")
{
}

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}

public virtual DbSet<Score> Scores { get; set; }
}
}
Loading