public async Task <JsonResult> Get() { List <Appointment> l = AppointmentsDB.Appointments(); //await hub.Clients.Groups("testgroup").SendAsync("ReceiveMessage", l, l); return(new JsonResult(AppointmentsDB.Appointments())); }
public async Task <JsonResult> GetAll(string id) { Appointment appt = AppointmentsDB.Appointments().FirstOrDefault(x => x.Id == id); //await hub.Clients.Groups("testgroup").SendAsync("ReceiveMessage", appt.Start, appt.End); return(new JsonResult(appt)); }
public async Task <JsonResult> Post() { Appointment appointment = new Appointment(); AppointmentsDB.Appointments().Add(appointment); List <Appointment> appointments = AppointmentsDB.Appointments(); string jsonStr = JsonConvert.SerializeObject(appointments, Formatting.Indented); await hub.Clients.Groups("AllAppointments").SendAsync("AllAppointments", jsonStr); return(new JsonResult(appointment)); }
public async Task <JsonResult> ModifyOne(string id) { Appointment appt = AppointmentsDB.Appointments().FirstOrDefault(x => x.Id == id); if (Request.Form["PatientName"].Count > 0) { appt.PatientName = Request.Form["PatientName"]; } List <Appointment> appointments = AppointmentsDB.Appointments(); string jsonStr = JsonConvert.SerializeObject(appointments, Formatting.Indented); await hub.Clients.Groups(appt.Id).SendAsync("UpdateApptInfo", appt.Id, appt); //await hub.Clients.Groups("AllAppointments").SendAsync("AllAppointments", jsonStr); return(new JsonResult(appt)); }