コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,TimeStamp,InsideOrOutside,Temp,AirHumidity,RiskForMold")] JoinTables joinTables)
        {
            if (ModelState.IsValid)
            {
                _context.Add(joinTables);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(joinTables));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,TimeStamp")] Date date)
        {
            if (ModelState.IsValid)
            {
                _context.Add(date);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(date));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,InsideOrOutside,DateId")] Enviornment enviornment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(enviornment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DateId"] = new SelectList(_context.Dates, "Id", "Id", enviornment.DateId);
            return(View(enviornment));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,Temp,EnviornmentId")] Temperature temperature)
        {
            if (ModelState.IsValid)
            {
                _context.Add(temperature);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnviornmentId"] = new SelectList(_context.Enviornments, "Id", "Id", temperature.EnviornmentId);
            return(View(temperature));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("Id,AirHumidity,EnviornmentId")] Humidity humidity)
        {
            if (ModelState.IsValid)
            {
                _context.Add(humidity);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnviornmentId"] = new SelectList(_context.Enviornments, "Id", "Id", humidity.EnviornmentId);
            return(View(humidity));
        }