public ObjectResult Post([FromForm] APIAppointment apiAppt) { var newAppt = (AgendaAppointment)apiAppt; _context.Appointments.Add(newAppt); _context.SaveChanges(); return(Ok(new { tid = newAppt.Id, action = "inserted" })); }
public ObjectResult Put(int id, [FromForm] APIAppointment apiAppt) { var updatedAppt = (AgendaAppointment)apiAppt; var dbAppt = _context.Appointments.Find(id); dbAppt.Name = updatedAppt.Name; dbAppt.StartDate = updatedAppt.StartDate; dbAppt.EndDate = updatedAppt.EndDate; _context.SaveChanges(); return(Ok(new { action = "updated" })); }