//[HttpPost] //public async Task<IActionResult> EditarFile(TeacherFileModel model, IFormFile file) //{ // var rutaPdf = _config.GetSection("rutas").GetSection("TeacherFiles").Value; // //var file = model.FormFile; // if (model.TeacherFileTypeId == null) // { // EnviarMensaje.Enviar(TempData, "red", "El tipo de archivo es requerido"); // return RedirectToAction("AgregarDocumento", new { id = model.TeacherId }); // } // if (file != null) // { // //upload files to wwwroot // //var fileName = Path.GetFileName(file.FileName); // //judge if it is pdf file // string ext = Path.GetExtension(file.FileName); // var fileName = model.TeacherId + "-" + Guid.NewGuid() + ext; // if (ext.ToLower() != ".pdf") // { // return RedirectToAction("AgregarDocumento", new { id = model.TeacherId }); // } // var fileFullPath = Path.Combine(rutaPdf, fileName); // //var filePath = "\\app-assets\\documentos\\teacher" + fileName; // using (var fileSteam = new FileStream(fileFullPath, FileMode.Create)) // { // await file.CopyToAsync(fileSteam); // } // //your logic to save filePath to database, for example // model.File.FileName = file.FileName; // model.File.FilePath = fileName; // model.File.FileFullPath = fileFullPath; // model.File.FileTypeId = model.TeacherFileTypeId; // var data = CopyPropierties.Convert<TeacherFileModel, TeacherFile>(model); // try // { // _teacherFile.Save(data); // } // catch (Exception e) // { // return RedirectToAction("AgregarDocumento", new { id = model.TeacherId }); // } // } // else // { // EnviarMensaje.Enviar(TempData, "red", "El archivo es requerido"); // return RedirectToAction("AgregarDocumento", new { id = model.TeacherId }); // } // return RedirectToAction("AgregarDocumento", new { id = model.TeacherId }); //} public IActionResult AgregarDireccion(int id) { var model = new ContactAddressModel(); var contactId = _teacher.GetContactId(id); var teacherById = _teacher.GetById(id); model.ContactId = contactId; model.TeacherId = teacherById.TeacherId; model.TeacherFullName = teacherById.Contact.ContactName + " " + teacherById.Contact.ContactLastname; model.ContactAddressList = _contactAddress.GetByContactId(contactId).ToList(); ViewBag.Countries = new SelectList(_country.GetAll, "CountryId", "CountryName"); ViewBag.Cities = new SelectList(_city.Cities, "CityId", "CityName"); ViewBag.Province = new SelectList(_province.Provinces, "ProvinceId", "ProvinceName"); ViewBag.AddressTypes = new SelectList(_addressType.addressTypes, "AddressTypeId", "AddressTypeName"); return(View(model)); }