public async Task <RequestShared> GetRequestes(int requestId) { RequestsContext db = new RequestsContext(); var request = await db.Request.Select(e => new RequestShared { RequestId = e.RequestId, Title = e.Title, CategoryId = e.CategoryId, Description = e.Description, CityId = e.CityId, Address = e.Address, PostalCode = e.PostalCode, PhoneNumber = e.PhoneNumber, Email = e.Email }).FirstOrDefaultAsync(e => e.RequestId.Equals(requestId)); return(request); }
static void Main(string[] args) { using (var db = new RequestsContext()) { db.Requests.Add(new Requests { Index = 5, Name = "Another Blog ", Visits = null, Date = DateTime.Now }); db.SaveChanges(); var requests = db.Requests; foreach (var request in db.Requests) { Console.WriteLine(request.Name); } var s = db.Database.Connection.Database; var t = db.Database.Connection.ConnectionString; var c = requests.Count(); } //Console.WriteLine("Hello World!"); //Console.ReadKey(); }
public RequestController(ILogger <RequestController> logger, RequestsContext context, UserManager <ApplicationUser> user) { this.logger = logger; _context = context; _user = user; }
public DataFunctions(RequestsContext db) { _db = db; }