private void BindResults() { EntidadesConosud dc = new EntidadesConosud(); Instructivos newArchivo = null; if (idInstructivo.Value == "") { newArchivo = new Instructivos(); newArchivo.NombreFisico = RadUpload1.UploadedFiles[0].GetName(); dc.AddToInstructivos(newArchivo); } else { long id = long.Parse(idInstructivo.Value); newArchivo = (from i in dc.Instructivos where i.IdInstructivo == id select i).FirstOrDefault(); if (newArchivo != null && RadUpload1.UploadedFiles.Count > 0) { newArchivo.NombreFisico = RadUpload1.UploadedFiles[0].GetName(); } } if (newArchivo != null) { newArchivo.Fecha = DateTime.Now; newArchivo.NombreAlias = txtAlias.Text; newArchivo.Descripcion = txtDescricpcion.Text; dc.SaveChanges(); } }
public static object EliminarRegistro(string Id, string Archivo) { long id = long.Parse(Id); EntidadesConosud dc = new EntidadesConosud(); Instructivos objEliinar = (from v in dc.Instructivos where v.IdInstructivo == id select v).First(); dc.DeleteObject(objEliinar); dc.SaveChanges(); string rutaArchivo = HttpContext.Current.Server.MapPath("Instructivos") + "/" + Archivo; if (System.IO.File.Exists(rutaArchivo)) { System.IO.File.Delete(rutaArchivo); } return(GetData()); }