NavigationLogic.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using CZFW.Framework.Model.ViewModel;
  2. using MongoDB.Bson;
  3. using System;
  4. namespace CZFW.MDB.Navigation
  5. {
  6. public class NavigationLogic : INavigation
  7. {
  8. IMongoRepository _repository;
  9. public NavigationLogic(IMongoRepository mongoRepository)
  10. {
  11. _repository = mongoRepository;
  12. _repository.SetCurrentTable("navigation");
  13. }
  14. public ResultModel Add(string navJson)
  15. {
  16. _repository.AsureTableExist("navigation");
  17. _repository.SetCurrentTable("navigation");
  18. var res = _repository.Insert(navJson);
  19. return res;
  20. }
  21. public BsonArray GetList(string sid)
  22. {
  23. var query = $"{{sid:'{sid}'}}";
  24. var list = _repository.GetList(query);
  25. return list;
  26. }
  27. public BsonDocument Get(string id)
  28. {
  29. var res = _repository.Get(id);
  30. return res;
  31. }
  32. public BsonDocument GetByName(string name)
  33. {
  34. throw new NotImplementedException();
  35. }
  36. public ResultModel Remove(string id)
  37. {
  38. return _repository.Remove(id);
  39. }
  40. public ResultModel Update(string id, string set, string arrayFilter = null)
  41. {
  42. throw new NotImplementedException();
  43. }
  44. public ResultModel Replace(string id, string newObjJson)
  45. {
  46. var tp = _repository.Replace(id, newObjJson);
  47. return tp;
  48. }
  49. }
  50. }