Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save samueleresca/3e4d7f3f0b600724b20e to your computer and use it in GitHub Desktop.
Save samueleresca/3e4d7f3f0b600724b20e to your computer and use it in GitHub Desktop.
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