public static List<Order> GetList() { var dbContext = new DatabaseContext(); List<Order> orders = dbContext.Orders .ToList(); return orders; }
public static List<Refill> GetList() { var dbContext = new DatabaseContext(); List<Refill> refill = dbContext.Refills .ToList(); return refill; }
public static List<OrderItem> GetList() { var dbContext = new DatabaseContext(); List<OrderItem> orderItem = dbContext.OrderItems .ToList(); return orderItem; }
public static List<Vehicle> GetList() { var dbContext = new DatabaseContext(); List<Vehicle> vehicles = dbContext.Vehicles .ToList(); return vehicles; }
public static List<Trip> GetList() { var dbContext = new DatabaseContext(); List<Trip> trip = dbContext.Trips .ToList(); return trip; }
public static List<Photo> GetList() { var dbContext = new DatabaseContext(); List<Photo> photos = dbContext.Photos .ToList(); return photos; }
public static List<Driver> GetList() { var dbContext = new DatabaseContext(); List<Driver> drivers = dbContext.Drivers .ToList(); return drivers; }
public static List<PollVote> GetList() { var dbContext = new DatabaseContext(); List<PollVote> pollVotes = (from pollvt in dbContext.PollVotes orderby pollvt.Id descending select pollvt).ToList(); return pollVotes; }
public static List<Poll> GetList() { var dbContext = new DatabaseContext(); List<Poll> polls = (from poll in dbContext.Polls orderby poll.Id descending select poll).ToList(); return polls; }
public static List<Work> GetList() { var dbContext = new DatabaseContext(); List<Work> works = (from wk in dbContext.Works orderby wk.Id descending select wk).ToList(); return works; }
public static List<Article> GetList() { var dbContext = new DatabaseContext(); List<Article> articles = (from art in dbContext.Articles orderby art.Id descending select art).ToList(); return articles; }
public void UpdateViews(int id, int views) { try { using (var ctx = new DatabaseContext()) { ctx.Database.ExecuteSqlCommand("UPDATE works SET views = {1} where id = {0}", id, views); ctx.SaveChanges(); } } catch (Exception ex) { } }
public bool UpdatePassword(int id, string password) { bool updated = false; try { using (var ctx = new DatabaseContext()) { ctx.Database.ExecuteSqlCommand("UPDATE users SET password = {1} where id = {0}", id, password); ctx.SaveChanges(); updated = true; } } catch(Exception ex) { updated = false; } return updated; }
public PollDa(DatabaseContext databasecontext) { _databasecontext = databasecontext; }
public WorkDa(DatabaseContext databasecontext) { _databasecontext = databasecontext; }
public static List<User> GetList() { var dbContext = new DatabaseContext(); List<User> users = (from usr in dbContext.Users orderby usr.Id descending select usr).ToList(); return users; }
public UserDa(DatabaseContext databasecontext) { _databasecontext = databasecontext; }
public VehicleDa(DatabaseContext databasecontext) { _databasecontext = databasecontext; }
public static List<Role> GetRoleList() { var dbContext = new DatabaseContext(); List<Role> roles = dbContext.Roles .ToList(); return roles; }
public TripDa(DatabaseContext databasecontext) { _databasecontext = databasecontext; }
public PhotoDa(DatabaseContext databasecontext) { _databasecontext = databasecontext; }
public OrderItemDa(DatabaseContext databasecontext) { _databasecontext = databasecontext; }
public RefillDa(DatabaseContext databasecontext) { _databasecontext = databasecontext; }
public DriverDa(DatabaseContext databasecontext) { _databasecontext = databasecontext; }