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.

39 lines
1.1 KiB

  1. using HKLib.SQLHelper.Entity;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace HKLib.SQLHelper
  6. {
  7. public class SqlLogic
  8. {
  9. public static PriceModel GetPrice()
  10. {
  11. return DbContext.Context.Queryable<PriceModel>().First();
  12. }
  13. public static PriceModel AddPrice(PriceModel input)
  14. {
  15. DbContext.Context.Deleteable<PriceModel>().Where(t => t.Id != 0).ExecuteCommand();
  16. return DbContext.Context.Insertable(input).ExecuteReturnEntity();
  17. }
  18. public static AdminModel AddAmin(string CardNo)
  19. {
  20. var d = new AdminModel
  21. {
  22. Name="管理员"+ CardNo,
  23. CardNo = CardNo
  24. };
  25. return DbContext.Context.Insertable(d).ExecuteReturnEntity();
  26. }
  27. public static AdminModel GetAdmin(string CardNo)
  28. {
  29. return DbContext.Context.Queryable<AdminModel>().First(t => t.CardNo == CardNo);
  30. }
  31. public static int GetAdmin()
  32. {
  33. return DbContext.Context.Queryable<AdminModel>().Select(t => t.Id).Count();
  34. }
  35. }
  36. }