38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.Serialization;
|
|
using System.ServiceModel;
|
|
using System.Text;
|
|
using System.Web.Mvc;
|
|
using Weee.Models;
|
|
using Weee.Service;
|
|
|
|
namespace Weee.WCFService
|
|
{
|
|
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "WCFProductService" in code, svc and config file together.
|
|
// NOTE: In order to launch WCF Test Client for testing this service, please select WCFProductService.svc or WCFProductService.svc.cs at the Solution Explorer and start debugging.
|
|
// [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, IncludeExceptionDetailInFaults = true)]
|
|
public class WCFProductService : IWCFProductService
|
|
{
|
|
private readonly WeeeProductDataService service;
|
|
public WCFProductService()
|
|
{
|
|
service = DependencyResolver.Current.GetService<WeeeProductDataService>();
|
|
service.DisableProxyAndLazyLoad();
|
|
}
|
|
|
|
public IEnumerable<Product> GetProducts(string authId)
|
|
{
|
|
service.Initialize(authId);
|
|
return service.GetProducts();
|
|
}
|
|
|
|
public Product SaveProduct(Product toBeSave, string authId)
|
|
{
|
|
service.Initialize(authId);
|
|
return service.SaveProduct(toBeSave);
|
|
}
|
|
}
|
|
}
|