You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.6 KiB

  1. using EasyBL;
  2. using EasyBL.WebApi.Common;
  3. using EasyBL.WebApi.Filters;
  4. using EasyBL.WebApi.Message;
  5. using EasyBL.WEBAPP;
  6. using EasyBL.WEBAPP.SYS;
  7. using EasyNet;
  8. using Entity.ShowEasyDtos;
  9. using Entity.Sugar;
  10. using Newtonsoft.Json;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Linq;
  14. using System.Net;
  15. using System.Net.Http;
  16. using System.Web.Http;
  17. namespace WebApp.Controllers
  18. {
  19. public class FavoriteController : ApiController
  20. {
  21. [HttpPost]
  22. [SEApiSecurityFilter]
  23. public HttpResponseMessage Favorite([FromBody] FavoriteDTO favorite)
  24. {
  25. // get authtoken
  26. var SEToken = SETokenUtil.GetToken(this.Request);
  27. favorite.MemberID = SEToken.Email;
  28. return new FavoriteService().SaveFavorite(favorite);
  29. }
  30. [HttpGet]
  31. [SEApiSecurityFilter]
  32. public HttpResponseMessage Favorites()
  33. {
  34. // get authtoken
  35. var SEToken = SETokenUtil.GetToken(this.Request);
  36. // get MemberID from authtoken
  37. FavoriteDTO favorite = new FavoriteDTO();
  38. favorite.MemberID = SEToken.Email;
  39. return new FavoriteService().GetFavorites(favorite);
  40. }
  41. [HttpGet]
  42. [SEApiSecurityFilter]
  43. public HttpResponseMessage Favorites(string Type)
  44. {
  45. // get authtoken
  46. var SEToken = SETokenUtil.GetToken(this.Request);
  47. FavoriteDTO favorite = new FavoriteDTO();
  48. favorite.MemberID = SEToken.Email;
  49. favorite.Type = Type;
  50. return new FavoriteService().GetFavorites(favorite);
  51. }
  52. }
  53. }