public static void InsertToTable(int userId) { try { using (var context = new NomadContext()) { context.Deliveries.Add(new Delivery { UserId = userId, DeadLineDate = DateTime.Now.AddDays(10), Status = "Не доставлено" }); } } catch (Exception exception) { Console.WriteLine(exception.Message); } }
public static string CheckForAvailabilityPassword(string data) { string password = ""; try { using (var context = new NomadContext()) { password = context.Users .Where(u => u.Login == data) .Select(u => u.Password).FirstOrDefault(); } } catch (Exception exception) { Console.WriteLine(exception.Message); } return(password); }
public static int GetUserId(string login) { int id = 0; try { using (var context = new NomadContext()) { id = context.Users .Where(u => u.Login == login) .Select(u => u.Id).FirstOrDefault(); } } catch (Exception exception) { Console.WriteLine(exception.Message); } return(id); }
public static void InsertToTable(int months, int userId) { try { using (var context = new NomadContext()) { context.SubscriptionLogs.Add(new SubscriptionLog { UserId = userId, SubscriptionStart = DateTime.Now, SubscriptionEnd = DateTime.Now.AddMonths(months), PricePerMonth = 100, MagazinePrice = 75 }); context.SaveChanges(); } } catch (Exception exception) { Console.WriteLine(exception.Message); } }