Advertisement
Guest User

UserRepository_old

a guest
Jun 7th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.Entity;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using ProjectDB;
  8. using ProjectDB.Entities;
  9.  
  10. //namespace DataAccess.Repositories
  11. //{
  12.  //   public class UserRepositoryy
  13. //}
  14. //        class UserRepository<T> : RepositoryBase<T>
  15. //        where T : class
  16. //    {
  17. //        protected CourseProjectDbContext ctx;
  18.  
  19. //        public UserRepository() =>
  20. //        ctx = new CourseProjectDbContext();
  21.  
  22. //        public UserRepository(CourseProjectDbContext ctx)
  23. //        {
  24. //            this.ctx = ctx;
  25. //        }
  26.  
  27. //        public User GetById(int? id)
  28. //        {
  29. //            return ctx.User.Find(id);
  30. //        }
  31.  
  32. //        public User GetByUsername(string username)
  33. //        {
  34. //            return ctx.User.Find(username);
  35. //        }
  36.  
  37. //        public User GetAll(int id, string firstName, string LastName, string username, int PhoneNumber)
  38. //        {
  39. //            return ctx.User.Find(id, firstName, LastName, username, PhoneNumber);
  40. //        }
  41.  
  42. //        public string Login(string UserName, string Password)
  43. //        {
  44. //            if (ctx.User.Any(x => x.UserName == UserName && x.Password == Password))
  45. //            {
  46. //                return "Hello, " + UserName + "." + "You are logged successfully";
  47. //            }
  48. //            throw new UnauthorizedAccessException();
  49. //        }
  50.  
  51. //        public void Register(User user)
  52. //        {
  53. //            ctx.User.Add(user);
  54. //        }
  55.  
  56. //        public void Saved()
  57. //        {
  58. //            ctx.SaveChanges();
  59. //        }
  60.  
  61. //        // Inserted class
  62. //        public class User
  63. //        {
  64. //            public int ID { get; set; }
  65. //            public string Username { get; set; }
  66. //            public bool IsAdministrator { get; set; }
  67. //        }
  68. //        public class RepositoryUser
  69. //        {
  70. //            public User GetUserByNameAndPassword(string username, string password)
  71. //            {
  72. //                return new User()
  73. //                {
  74. //                    ID = 1,
  75. //                    Username = username,
  76. //                    IsAdministrator = true
  77. //                };
  78. //            }
  79. //        }
  80.  
  81. //    }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement