public IActionResult GetEvent(int CovidTestEvents) { DataLayer.Models.CovidTestEvents result = CovidTest.GetCovidTestEvents(_context, CovidTestEvents); if (result == null) { return(NoContent()); } else { return(Ok(result)); } }
public IActionResult SaveEvent([FromBody] DataLayer.Models.CovidTestEventsJSon json) { _context.SaveError("Entering Save CovidtestEvents", ""); try { DataLayer.Models.CovidTestEvents model = new DataLayer.Models.CovidTestEvents(); model.enddate = DateTime.Parse(json.enddate); model.startdate = DateTime.Parse(json.startdate); model.Title = json.Title; model.SignupID = json.SignupID; model.TotalSlots = json.TotalSlots; model.FilledSlots = json.FilledSlots; CovidTest.AddEventRecord(_context, model); } catch (Exception ex) { _context.SaveError("In Update", ex.Message); return(BadRequest(ex.Message)); } return(Ok("Success")); }