public async Task SaveDocument(Document document)
 {
     using (var context = new DMSEntities())
     {
         context.Configuration.ProxyCreationEnabled = true;
         context.Entry(document).State = EntityState.Added;
         int x = await(context.SaveChangesAsync());
     }
 }
Beispiel #2
0
        public async Task <User> ValidateUser(string userName, string password)
        {
            using (var context = new DMSEntities())
            {
                context.Configuration.ProxyCreationEnabled = false;
                var user = context.Users.Where(x => x.LoginName == userName && x.Password == password).FirstOrDefault();

                return(user);
            }
        }
        public async Task <List <Document> > GetDocumentByUserId(int userId)
        {
            List <Document> documents = null;

            using (var context = new DMSEntities())
            {
                context.Configuration.ProxyCreationEnabled = false;
                documents = await(context.Documents.Where(s => s.UserId == userId).ToListAsync());
            }
            return(documents);
        }
Beispiel #4
0
 public BaseRepository(DMSEntities context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }