Example #1
0
        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);
        }
Example #2
0
        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();
        }
Example #3
0
 public RequestController(ILogger <RequestController> logger, RequestsContext context, UserManager <ApplicationUser> user)
 {
     this.logger = logger;
     _context    = context;
     _user       = user;
 }
Example #4
0
 public DataFunctions(RequestsContext db)
 {
     _db = db;
 }