public async Task <IActionResult> NewIncident(IncidentModel model)
        {
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest();
            //}

            var incident = new IncidentEntity
            {
                Description = model.Description,
                Latitude    = model.Latitude,
                Longitude   = model.Longitude,
                Group       = model.Group,
            };

            _dbContext.Add(incident);
            await _dbContext.SaveChangesAsync();

            return(RedirectToAction("IncidentList"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Register(RadioModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var radioEntity = new RadioEntity
            {
                Name           = model.Name,
                Type           = model.Type,
                SerialNumber   = model.SerialNumber,
                SignalStrength = model.SignalStrength,
                BatteryLevel   = model.BatteryLevel,
                Mode           = model.Mode,
                Unit           = model.Unit
            };

            _dbContext.Add(radioEntity);
            await _dbContext.SaveChangesAsync();

            return(RedirectToAction("RegisterConfirmation"));
        }