public IHttpActionResult UpdateInformacionBasica([FromBody] tb_informacion_basica infoBasica) { Response <Boolean> response = new Response <bool>(); var controlInfoBasica = FactoryIoC.Container.Resolver <ControlInformacionBasica>(); return(Json(controlInfoBasica.lfUpdate(infoBasica), new JsonSerializerSettings() { PreserveReferencesHandling = PreserveReferencesHandling.Objects, Formatting = Formatting.Indented })); }
public Response <bool> lfUpdate(tb_informacion_basica infoBasica) { Response <bool> response = new Response <bool>(); try { response.ReturnValue = DomainInfoBasica.Update(infoBasica); } catch (Exception ex) { response.blnTransactionIndicator = false; response.ReturnValue = false; response.strOrigin = ex.ToString(); } return(response); }
public Response <bool> lfDelete(int idTemp) { Response <bool> response = new Response <bool>(); try { tb_informacion_basica infoBasica = new tb_informacion_basica(); infoBasica.id = idTemp; response.ReturnValue = DomainInfoBasica.Delete(infoBasica); } catch (Exception ex) { response.blnTransactionIndicator = false; response.ReturnValue = false; response.strOrigin = ex.ToString(); } return(response); }
public async Task <ActionResult> CrearInformacionBasica(FormCollection datos) { Response <tb_informacion_basica> respuesta = new Response <tb_informacion_basica>(); tb_informacion_basica infoBasica = new tb_informacion_basica(); try { infoBasica.id = Int32.Parse(datos.GetValue("id").AttemptedValue.ToString()); infoBasica.id_origen = Int32.Parse(datos.GetValue("id_origen").AttemptedValue.ToString()); infoBasica.id_subcategoria_delito = Int32.Parse(datos.GetValue("id_subcategoria_delito").AttemptedValue.ToString()); infoBasica.id_modalidad = Int32.Parse(datos.GetValue("id_modalidad").AttemptedValue.ToString()); infoBasica.id_subvictima = Int32.Parse(datos.GetValue("id_subvictima").AttemptedValue.ToString()); infoBasica.id_oficina_encargado = Int32.Parse(datos.GetValue("id_oficina_encargado").AttemptedValue.ToString()); infoBasica.id_delegacion = Int32.Parse(datos.GetValue("id_delegacion").AttemptedValue.ToString()); infoBasica.tentativo = Int32.Parse(datos.GetValue("tentativo").AttemptedValue.ToString()); infoBasica.id_hecho = Int32.Parse(datos.GetValue("id_hecho").AttemptedValue.ToString()); infoBasica.numero_unico = datos.GetValue("numero_unico").AttemptedValue.ToString(); infoBasica.fecha_ingreso = DateTime.Parse(datos.GetValue("fecha_ingreso").AttemptedValue.ToString()); infoBasica.perjuicio = datos.GetValue("perjuicio").AttemptedValue.ToString(); infoBasica.moneda = datos.GetValue("moneda").AttemptedValue.ToString(); infoBasica.observaciones = datos.GetValue("observaciones").AttemptedValue.ToString(); infoBasica.narracion = datos.GetValue("narracion").AttemptedValue.ToString(); String jsonContent = JsonConvert.SerializeObject(infoBasica); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(jsonContent); ByteArrayContent byteArrayContent = new ByteArrayContent(buffer); byteArrayContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); HttpResponseMessage consulta = await _WsWebAPI.PostAsync("api/informacionBasica/", byteArrayContent); if (consulta.IsSuccessStatusCode) { respuesta = JsonConvert.DeserializeObject <Response <tb_informacion_basica> >(consulta.Content.ReadAsStringAsync().Result); infoBasica = respuesta.ReturnValue; } } catch (Exception ex) { System.Console.Write(ex.ToString()); } return(View()); }
public async Task <ActionResult> eliminarInformacionBasica(int id) { tb_informacion_basica infoBasica = new tb_informacion_basica(); Response <tb_informacion_basica> respuesta = new Response <tb_informacion_basica>(); try { HttpResponseMessage consulta = await _WsWebAPI.DeleteAsync(String.Concat("api/informacionBasica/", id)); if (consulta.IsSuccessStatusCode) { respuesta = JsonConvert.DeserializeObject <Response <tb_informacion_basica> >(consulta.Content.ReadAsStringAsync().Result); infoBasica = respuesta.ReturnValue; } } catch (Exception ex) { System.Console.Write(ex.ToString()); } return(View()); }