private Tecnico ToTecnico(TecnicoView view) { return(new Tecnico { Tecn_ID = view.Tecn_ID, Tecn_Nombre = view.Tecn_Nombre, Tecn_Correo = view.Tecn_Correo, Tecn_Contrasenia = view.Tecn_Contrasenia, Tecn_Domicilio = view.Tecn_Domicilio, Tecn_Activo = view.Tecn_Activo, Tecn_Promedio = view.Tecn_Promedio, Tecn_Imagen = view.Tecn_Imagen, Tecn_FechaHora = view.Tecn_FechaHora, Tecn_ModificadoPor = view.Tecn_ModificadoPor }); }
public async Task <ActionResult> Edit(TecnicoView view) { if (ModelState.IsValid) { var pic = view.Tecn_Imagen; var folder = "~/Content/Images"; if (view.ImageFile != null) { pic = FilesHelper.UploadPhoto(view.ImageFile, folder); pic = string.Format("{0}/{1}", folder, pic); } var tecnico = ToTecnico(view); tecnico.Tecn_Imagen = pic; db.Entry(tecnico).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(view)); }