Esempio n. 1
0
        public static void AddEventRecord(DataSurfContext context, CovidTestEvents model)
        {
            CovidTestEvents result = context.CovidTestEvents.FirstOrDefault(result => result.SignupID == model.SignupID);

            if (result == null)
            {
                result             = new CovidTestEvents();
                result.SignupID    = model.SignupID;
                result.startdate   = model.startdate;
                result.enddate     = model.enddate;
                result.Title       = model.Title;
                result.TotalSlots  = model.TotalSlots;
                result.FilledSlots = model.FilledSlots;
                context.CovidTestEvents.Add(result);
            }
            else
            {
                result.startdate   = model.startdate;
                result.enddate     = model.enddate;
                result.Title       = model.Title;
                result.TotalSlots  = model.TotalSlots;
                result.FilledSlots = model.FilledSlots;
                context.CovidTestEvents.Update(result);
            }
            context.SaveChangesAsync();
        }
Esempio n. 2
0
        public static Models.CovidTestEvents GetCovidTestEvents(DataSurfContext context, int ID)
        {
            CovidTestEvents results = context.CovidTestEvents.FirstOrDefault(results => results.SignupEventId == ID);

            return(results);
        }