Created
December 4, 2015 20:55
-
-
Save samueleresca/3e4d7f3f0b600724b20e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Blog.MockingWebAPI.Repository; | |
using Bungles.FindDrinks.Models; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Web.Http; | |
namespace Bongles.WebAPI.Controllers | |
{ | |
/// | |
/// LocationsController: returns information about your Location | |
/// | |
public class LocationsController : ApiController | |
{ | |
public databaseEF db { get; set; } | |
/// | |
/// Default constructor | |
/// | |
public LocationsController() | |
{ | |
this.db = new databaseEF(); | |
} | |
/// | |
/// Constructor used by Moq | |
/// | |
/// Repository | |
public LocationsController(databaseEF mockDB) | |
{ | |
this.db = mockDB; | |
} | |
/// | |
/// Controller used to get location by id | |
/// GET api/values/id | |
/// | |
/// /// | |
public Location Get(int locationId) | |
{ | |
// | |
//Prendo quello con id corrispondente | |
// | |
return db.locations.Where(l => l.id == locationId).ToList().FirstOrDefault(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment