public async Task <HttpResponseMessage> GetTurno(IdModelTurno Id) { try { _turno = await db.Turno.FindAsync(Id.IdTurno); if (_turno == null) { return(new HttpResponseMessage(HttpStatusCode.NoContent)); } else { return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(JsonConvert.SerializeObject(_turno), System.Text.Encoding.UTF8, "application/json") }); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(ex.Message) }); } }
public async Task <HttpResponseMessage> DeleteTurno(IdModelTurno Id) { try { _turno = await db.Turno.FindAsync(Id.IdTurno); if (_turno == null) { return(new HttpResponseMessage(HttpStatusCode.NoContent)); } else { _turno.Activo_Inactivo = false; db.Entry(_turno).State = EntityState.Modified; await db.SaveChangesAsync(); return(new HttpResponseMessage(HttpStatusCode.OK)); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(ex.Message) }); } }