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;
using System.Web.Http;
using System.Collections.Specialized;
using Microsoft.Practices.Unity;
using Mug.SPA.WebUI.Dummies;
using Mug.SPA.WebUI.Model;

namespace Mug.SPA.WebUI.Controllers.Api {
    public class PropertiesController : ApiController {
        public IEnumerable<Property> Get() {
            return PropertyRepository.GetProperties();
        }
        
        public Property GetProduct(Int64 id) {
            var property = PropertyRepository.GetProperties().Where(x => x.PropertyID == id).FirstOrDefault();
            if (property == null) {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return property;
        }
    }
}