public async Task <HttpResponseMessage> GetUbicacion(IdModelUbicacion id) { try { _ubicacion = await db.Ubicacion.FindAsync(id.IdUbicacion); if (_ubicacion == null) { return(new HttpResponseMessage(HttpStatusCode.NoContent)); } else { return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(JsonConvert.SerializeObject(_ubicacion), System.Text.Encoding.UTF8, "application/json") }); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(ex.Message) }); } }
public async Task <HttpResponseMessage> DeleteUbicacion(IdModelUbicacion id) { try { _ubicacion = await db.Ubicacion.FindAsync(id.IdUbicacion); if (_ubicacion == null) { return(new HttpResponseMessage(HttpStatusCode.NoContent)); } else { _ubicacion.Activo_Inactivo = false; db.Entry(_ubicacion).State = EntityState.Modified; await db.SaveChangesAsync(); return(new HttpResponseMessage(HttpStatusCode.OK)); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(ex.Message) }); } }