public static File GetFile(long userId) { using (var dbContext = new PlannerDbContext()) { dbContext.Configuration.ProxyCreationEnabled = false; return dbContext.Set<File>().FirstOrDefault(_ => _.UserId == userId); } }
public static string Login(string email, string password) { Logger.log("Login now"); using (var dbContext = new PlannerDbContext()) { var user = dbContext .Set<User>() .FirstOrDefault(_ => _.Email.Equals(email) && _.Password.Equals(password)); if (user == null) { return (-1).ToString(); } return user.Id + ", " + user.Type; } }