public IActionResult Editar(int id) { var ProgramaDeBeca = _scholarshipProgram.GetById(id); //var scholarshipProgramModel = CopyPropierties.Convert<ScholarshipProgram, ScholarshipProgramModel>(ProgramaDeBeca); var scholarshipProgramModel = new ScholarshipProgramModel { ScholarshipProgramId = ProgramaDeBeca.ScholarshipProgramId, ScholarshipProgramName = ProgramaDeBeca.ScholarshipProgramName, ScholarshipLevelId = ProgramaDeBeca.ScholarshipLevelId, CreationDate = ProgramaDeBeca.CreationDate, UpgradeDate = ProgramaDeBeca.UpgradeDate, StatusId = ProgramaDeBeca.StatusId, ScholarshipLevel = ProgramaDeBeca.ScholarshipLevel, Status = ProgramaDeBeca.Status, ScholarshipProgramUniversityList = ProgramaDeBeca.ScholarshipProgramUniversity, }; ViewBag.Nivel = new SelectList(_scholarshipLevel.ScholarshipsLevel, "ScholarshipLevelId", "ScholarshipLevelName"); ViewBag.Status = new SelectList(_status.Status, "StatusId", "StatusName"); ViewBag.University = new SelectList(_university.Universities, "UniversityId", "UniversityName"); //scholarshipProgramModel.ScholarshipProgramUniversityList = _scholarshipProgramUniversity.ScholarshipProgramUniversity.ToList(); return(View("Crear", scholarshipProgramModel)); }
public IActionResult Crear(ScholarshipProgramModel model) { ViewBag.Nivel = new SelectList(_scholarshipLevel.ScholarshipsLevel, "ScholarshipLevelId", "ScholarshipLevelName"); ViewBag.Status = new SelectList(_status.Status, "StatusId", "StatusName"); ViewBag.University = new SelectList(_university.Universities, "UniversityId", "UniversityName"); //model.ScholarshipProgramUniversityList = _scholarshipProgramUniversity.ScholarshipProgramUniversity.ToList(); return(View(model)); }
public IActionResult GuardarPrograma(ScholarshipProgramModel model) { //var scholarshipProgramModel = CopyPropierties.Convert<ScholarshipProgramModel, ScholarshipProgram>(model); var scholarshipProgramModel = new ScholarshipProgram { ScholarshipProgramId = model.ScholarshipProgramId, ScholarshipProgramName = model.ScholarshipProgramName, ScholarshipLevelId = model.ScholarshipLevelId, CreationDate = model.CreationDate, UpgradeDate = model.UpgradeDate, StatusId = model.StatusId, ScholarshipLevel = model.ScholarshipLevel, Status = model.Status, //ScholarshipProgramUniversit = model.ScholarshipProgramUniversity //Status = model.Status, //ScholarshipProgramUniversity = model.ScholarshipProgramUniversityList, }; var ScholarshipProgramUniversity = model.ScholarshipProgramUniversity; try { if (ScholarshipProgramUniversity != null) { ScholarshipProgramUniversity.ScholarshipProgramId = model.ScholarshipProgramId; _scholarshipProgramUniversity.Save(ScholarshipProgramUniversity); } _scholarshipProgram.GuardarScholarshipProgram(scholarshipProgramModel); } catch (Exception e) { ViewBag.Nivel = new SelectList(_scholarshipLevel.ScholarshipsLevel, "ScholarshipLevelId", "ScholarshipLevelName"); ViewBag.Status = new SelectList(_status.Status, "StatusId", "StatusName"); ViewBag.University = new SelectList(_university.Universities, "UniversityId", "UniversityName"); return(View("Crear", model)); } var ScholarshipProgramList = _scholarshipProgram.GetAll.ToList(); return(View("Index", ScholarshipProgramList)); }
public IActionResult GuardarPrograma(ScholarshipProgramModel model, string prueba) { if (ModelState.IsValid) { var scholarshipProgramModel = new ScholarshipProgram { ScholarshipProgramId = model.ScholarshipProgramId, ScholarshipProgramName = model.ScholarshipProgramName, ScholarshipLevelId = model.ScholarshipLevelId, CreationDate = model.CreationDate, UpgradeDate = model.UpgradeDate, StatusId = model.StatusId, ScholarshipLevel = model.ScholarshipLevel, Status = model.Status, }; try { _scholarshipProgram.GuardarScholarshipProgram(scholarshipProgramModel); } catch (Exception e) { ViewBag.Nivel = new SelectList(_scholarshipLevel.ScholarshipsLevel, "ScholarshipLevelId", "ScholarshipLevelName"); ViewBag.Status = new SelectList(_status.Status, "StatusId", "StatusName"); ViewBag.University = new SelectList(_university.Universities, "UniversityId", "UniversityName"); return(View("Crear", model)); } } else { var errors = ModelState.Select(x => x.Value.Errors).FirstOrDefault(x => x.Count > 0).First(); EnviarMensaje.Enviar(TempData, "red", errors.ErrorMessage); ViewBag.Nivel = new SelectList(_scholarshipLevel.ScholarshipsLevel, "ScholarshipLevelId", "ScholarshipLevelName"); ViewBag.Status = new SelectList(_status.Status, "StatusId", "StatusName"); ViewBag.University = new SelectList(_university.Universities, "UniversityId", "UniversityName"); return(View("Crear", model)); } return(View("Index", _scholarshipProgram.GetAll.ToList())); }
public IActionResult AgregarConvocatoriaProperties(ScholarshipProgramModel model) { var data = new ScholarshipProgramUniversityModel { ScholarshipProgramId = model.ScholarshipProgramId, //ScholarshipProgramId = model.ScholarshipProgramId, ScatProgramCode = model.ScholarshipProgramUniversity.ScatProgramCode, ContractNumber = model.ScholarshipProgramUniversity.ContractNumber, UniversityId = model.ScholarshipProgramUniversity.UniversityId, AnnouncementStartDate = model.ScholarshipProgramUniversity.AnnouncementStartDate, AnnouncementEndDate = model.ScholarshipProgramUniversity.AnnouncementEndDate, StartDate = model.ScholarshipProgramUniversity.StartDate, EndDate = model.ScholarshipProgramUniversity.EndDate }; return(RedirectToAction("AgregarConvocatoria", data)); }