using EasyBL; using EasyBL.WebApi.Common; using EasyBL.WebApi.Filters; using EasyBL.WebApi.Message; using EasyBL.WEBAPP; using EasyBL.WEBAPP.SYS; using EasyNet; using Entity.ShowEasyDtos; using Entity.Sugar; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; namespace WebApp.Controllers { public class FavoriteController : ApiController { [HttpPost] [SEApiSecurityFilter] public HttpResponseMessage Favorite([FromBody] FavoriteDTO favorite) { // get authtoken var SEToken = SETokenUtil.GetToken(this.Request); favorite.MemberID = SEToken.Email; return new FavoriteService().SaveFavorite(favorite); } [HttpGet] [SEApiSecurityFilter] public HttpResponseMessage Favorites() { // get authtoken var SEToken = SETokenUtil.GetToken(this.Request); // get MemberID from authtoken FavoriteDTO favorite = new FavoriteDTO(); favorite.MemberID = SEToken.Email; return new FavoriteService().GetFavorites(favorite); } [HttpGet] [SEApiSecurityFilter] public HttpResponseMessage Favorites(string Type) { // get authtoken var SEToken = SETokenUtil.GetToken(this.Request); FavoriteDTO favorite = new FavoriteDTO(); favorite.MemberID = SEToken.Email; favorite.Type = Type; return new FavoriteService().GetFavorites(favorite); } } }