public IActionResult Editar(int id)
        {
            var scholarshipProgramTracing = _scholarshipProgramTracing.GetById(id);



            var scholarshipProgramTracingModel = CopyPropierties.Convert <ScholarshipProgramTracing, ScholarshipProgramTracingModel>(scholarshipProgramTracing);
            var technicals = _agent.GetTechnicals.Select(x => new GetAgents {
                AgentId = x.AgentId, FullName = x.Contact.ContactName.ToString() + " " + x.Contact.ContactLastname
            });
            var coordinators = _agent.GetCoordinators.Select(x => new GetAgents {
                AgentId = x.AgentId, FullName = x.Contact.ContactName.ToString() + " " + x.Contact.ContactLastname
            });
            var scholarshipProgram = _scholarshipProgramUniversity.ScholarshipProgramUniversity
                                     .Select(x => new GetScholarShipProgram
            {
                ScholarshipProgramUniversityId = x.ScholarshipProgramUniversityId,
                ScholarShipProgramNameScatCodeContractNumber = x.ScholarshipProgram.ScholarshipProgramName.ToString() + ", " + x.ScatProgramCode.ToString()
                                                               + ", " + x.ContractNumber.ToString()
            });

            scholarshipProgramTracingModel.SelectedProgram = scholarshipProgramTracingModel.ScholarshipProgramUniversity.ScholarshipProgram.ScholarshipProgramName.ToString() + ", " +
                                                             scholarshipProgramTracingModel.ScholarshipProgramUniversity.ScatProgramCode.ToString() + ", " +
                                                             scholarshipProgramTracingModel.ScholarshipProgramUniversity.ContractNumber.ToString();


            ViewBag.ScholarshipProgram = new SelectList(scholarshipProgram, "ScholarshipProgramUniversityId", "ScholarShipProgramNameScatCodeContractNumber");
            ViewBag.Coordinator        = new SelectList(coordinators, "AgentId", "FullName");
            ViewBag.Technical          = new SelectList(technicals, "AgentId", "FullName");
            ViewBag.Status             = new SelectList(_status.Status, "StatusId", "StatusName");
            ViewBag.University         = new SelectList(_university.Universities, "UniversityId", "UniversityName");

            return(View("Crear", scholarshipProgramTracingModel));
        }
        public IActionResult GuardarEmpleado(EmpleadoViewModel model)
        {
            var empleadoData = _empleado.GetAll;

            if (ModelState.IsValid)
            {
                var data = CopyPropierties.Convert <EmpleadoViewModel, Empleado>(model);


                try
                {
                    _empleado.Save(data);
                }
                catch (Exception e)
                {
                    ViewBag.Posiciones = new SelectList(_posicion.GetAll, "PosicionId", "PosicionName");
                    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.Posiciones = new SelectList(_posicion.GetAll, "PosicionId", "PosicionName");
                return(View("Crear", model));
            }


            EnviarMensaje.Enviar(TempData, "green", "La informacion fue guardada");
            return(View("Index", empleadoData));
        }
Ejemplo n.º 3
0
        public IActionResult EditarAcuerdos(EditarAcuerdoViewModel model, int acuerdoId, int scholarshipProgramUniversityId)
        {
            if (ModelState.IsValid)
            {
                var data = CopyPropierties.Convert <EditarAcuerdoViewModel, ScholarshipProgramUniversityAgreement>(model);

                try
                {
                    _scholarshipProgramUniversityAgreement.Save(data);
                }
                catch (Exception e)
                {
                    return(RedirectToAction("EditarAcuerdos", new { acuerdoId = model.ScholarshipProgramUniversityAgreementId, scholarshipProgramUniversityId = model.ScholarshipProgramUniversityId }));
                }
            }
            else
            {
                var errors = ModelState.Select(x => x.Value.Errors).FirstOrDefault(x => x.Count() > 0).First();

                EnviarMensaje.Enviar(TempData, "red", errors.ErrorMessage);

                return(RedirectToAction("EditarAcuerdos", new { acuerdoId = model.ScholarshipProgramUniversityAgreementId, scholarshipProgramUniversityId = model.ScholarshipProgramUniversityId }));
            }



            return(RedirectToAction("Editar", new { id = model.ScholarshipProgramUniversityId }));
        }
Ejemplo n.º 4
0
        public IActionResult Editar(int id)
        {
            var data = _teacher.GetById(id);

            var teacherEducation = new TeacherEducation();

            var model = CopyPropierties.Convert <Teacher, TeacherModel>(data);

            model.HigherTeacherEducation = teacherEducation;
            model.Name        = data.Contact.ContactName;
            model.LastName    = data.Contact.ContactLastname;
            model.Document    = data.Contact.ContactDocumentNumber;
            model.Nacionality = data.Contact.Nationality;


            ViewBag.ContactTypes      = new SelectList(_contactType.GetAll, "ContactTypeId", "ContactTypeName");
            ViewBag.DocumentType      = new SelectList(_documentType.GetAll, "DocumentTypeId", "DocumentTypeName");
            ViewBag.Countries         = new SelectList(_country.GetAll, "CountryId", "CountryName");
            ViewBag.Cities            = new SelectList(_city.Cities, "CityId", "CityName");
            ViewBag.AddressTypes      = new SelectList(_addressType.addressTypes, "AddressTypeId", "AddressTypeName");
            ViewBag.TeacherHiringType = new SelectList(_teacherHiringType.GetAll, "TeacherHiringTypeId", "TeacherHiringTypeName");
            ViewBag.EducationType     = new SelectList(_educationType.GetAll, "EducationTypeId", "EducationTypeName");
            ViewBag.TeacherEducation  = new SelectList(_teacherEducation.GetAll, "TeacherEducationId", "TeacherEducationTitle");
            ViewBag.Nationality       = new SelectList(_nationality.GetAll, "NationalityId", "NationalityName");
            ViewBag.MatirialStatus    = new SelectList(_matirialStatus.GetAll, "MaritalStatusId", "MaritalStatusName");
            ViewBag.University        = new SelectList(_university.Universities, "UniversityId", "UniversityName");


            return(View("Crear", model));
        }
Ejemplo n.º 5
0
        public IActionResult GuardarPosicion(PosicionViewModel model)
        {
            var posicionData = _posicion.GetAll;

            if (ModelState.IsValid)
            {
                var data = CopyPropierties.Convert <PosicionViewModel, Posicion>(model);
                try
                {
                    _posicion.Save(data);
                }
                catch (Exception e)
                {
                    EnviarMensaje.Enviar(TempData, "red", "Verifique el formulario");
                    return(View("Crear", model));
                }
            }
            else
            {
                EnviarMensaje.Enviar(TempData, "red", "Verifique el formulario");

                return(View("Crear", model));
            }


            EnviarMensaje.Enviar(TempData, "green", "La informacion fue guardada");
            return(View("Index", posicionData));
        }
Ejemplo n.º 6
0
        //[HttpPost]
        public IActionResult AgregarConvocatoria(ScholarshipProgramUniversityModel model)
        {
            if (ModelState.IsValid)
            {
                var data = CopyPropierties.Convert <ScholarshipProgramUniversityModel, ScholarshipProgramUniversity>(model);

                try
                {
                    _scholarshipProgramUniversity.Save(data);
                }
                catch (Exception e)
                {
                    return(RedirectToAction("Editar", new { id = model.ScholarshipProgramId }));
                }
            }
            else
            {
                var errors = ModelState.Select(x => x.Value.Errors).FirstOrDefault(x => x.Count > 0).First();

                EnviarMensaje.Enviar(TempData, "red", errors.ErrorMessage);


                return(RedirectToAction("Editar", new { id = model.ScholarshipProgramId }));
            }



            return(RedirectToAction("Editar", new { id = model.ScholarshipProgramId }));
        }
Ejemplo n.º 7
0
        public IActionResult GuardarTeacherEducation(TeacherEducationModel model)
        {
            var data = CopyPropierties.Convert <TeacherEducationModel, TeacherEducation>(model);

            if (ModelState.IsValid)
            {
                try
                {
                    _teacherEducation.Save(data);
                }
                catch (Exception e) {
                    return(RedirectToAction("TeacherEducation", new { id = model.TeacherId }));
                }
            }
            else
            {
                var errors = ModelState.Select(x => x.Value.Errors).FirstOrDefault(x => x.Count > 0).First();



                EnviarMensaje.Enviar(TempData, "red", errors.ErrorMessage);

                return(RedirectToAction("TeacherEducation", new { id = model.TeacherId }));
            }

            return(RedirectToAction("TeacherEducation", new { id = model.TeacherId }));
        }
Ejemplo n.º 8
0
        public IActionResult Guardar(TeacherModel model)
        {
            try
            {
                var data = CopyPropierties.Convert <TeacherModel, Teacher>(model);
                _teacher.Save(data);
            }
            catch (Exception e)
            {
                //var model = CopyPropierties.Convert<Teacher, TeacherModel>(data);
                //ViewBag.ContactTypes = new SelectList(_contactType.GetAll, "ContactTypeId", "ContactTypeName");
                //ViewBag.DocumentType = new SelectList(_documentType.GetAll, "DocumentTypeId", "DocumentTypeName");
                //ViewBag.Countries = new SelectList(_country.Country, "CountryId", "CountryName");
                //ViewBag.Cities = new SelectList(_country.Country, "CityId", "CityName");
                //ViewBag.AddressTypes = new SelectList(_addressType.addressTypes, "AddressTypeId", "AddressTypeName");
                ////ViewBag.Status = new SelectList(_status);
                //ViewBag.EducationType = new SelectList(_educationType.GetAll, "EducationTypeId", "EducationTypeName");
                //ViewBag.TeacherEducation = new SelectList(_teacherEducation.GetAll, "TeacherEducationId", "TeacherEducationTitle");
                //ViewBag.Nationality = new SelectList(_nationality.GetAll, "NationalityId", "NationalityName");
                //ViewBag.MatirialStatus = new SelectList(_matirialStatus.GetAll, "MaritalStatusId", "MaritalStatusName");

                //return View("Crear", model);
            }


            return(View("Index", _teacher.GetAll));
        }
Ejemplo n.º 9
0
        public IActionResult AgregarComunicacion(ContactCommunicationModel model)
        {
            var data = CopyPropierties.Convert <ContactCommunicationModel, ContactCommunication>(model);

            if (string.IsNullOrWhiteSpace(model.Communication.CommunicationPhoneNumber1) && string.IsNullOrWhiteSpace(model.Communication.CommunicationPhoneNumber2))
            {
                EnviarMensaje.Enviar(TempData, "red", "Al menos un número de contacto es requerido");
                return(RedirectToAction("AgregarComunicacion", new { id = model.TeacherId }));
            }

            if (string.IsNullOrWhiteSpace(model.Communication.CommunicationEmail))
            {
                EnviarMensaje.Enviar(TempData, "red", "El email es requerido ");
                return(RedirectToAction("AgregarComunicacion", new { id = model.TeacherId }));
            }

            try
            {
                _contactCommunication.Save(data);
            }
            catch (Exception e)
            {
                return(RedirectToAction("AgregarComunicacion", new { id = model.TeacherId }));
            }

            return(RedirectToAction("AgregarComunicacion", new { id = model.TeacherId }));
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> PerfilUsuarioAdmin(string id)
        {
            Usuario           user    = _usuario.GetUsuarioById(id);
            MensajesViewModel mensaje = new MensajesViewModel();
            var userId = _userManager.GetUserId(User);



            if (string.IsNullOrEmpty(id))
            {
                //EnviarMensaje.Enviar(TempData, "orange", "Debe de seleccionar una categoría válida!");
                return(View("Login"));
            }

            // 1. traer el usuairo

            //Usuario user = _usuario.GetUsuarioById(id);

            if (user == null)
            {
                //EnviarMensaje.Enviar(TempData, "orange", "Debe de seleccionar una categoría válida!");
                return(View("Login"));
            }

            // 2. Crear el modelo de resset password

            ResetPasswordViewModel rpvm = new ResetPasswordViewModel
            {
                UserName = user.UserName,
                Code     = await _userManager.GeneratePasswordResetTokenAsync(user)
            };

            //3.Crear el modelo  de UserUniversity
            //var userUniversity = new UserUniversityModel
            //{
            //    UsuarioId = user.Id,

            //}


            // 4. crear el modelo de la vista

            var model = new PerfilUsuario
            {
                EditarUsuarioModel     = CopyPropierties.Convert <Usuario, EditarUsuarioModel>(user),
                ResetPasswordViewModel = rpvm,
                Universidades          = _university.Universities,
                //UserUniversityModel =
            };



            ViewBag.Role = new SelectList(_role.Roles, "Name", "Name");


            return(View(model));
        }
Ejemplo n.º 11
0
        public IActionResult Editar(int id)
        {
            var data = _subjectMatter.GetById(id);

            var model = CopyPropierties.Convert <SubjectMatter, SubjectMatterModel>(data);

            ViewBag.Status = new SelectList(_status.Status, "StatusId", "StatusName");
            return(View("Crear", model));
        }
Ejemplo n.º 12
0
        public IActionResult EditarAcuerdos(int acuerdoId, int scholarshipProgramUniversityId)
        {
            var data = _scholarshipProgramUniversityAgreement.GetById(acuerdoId);

            var model = CopyPropierties.Convert <ScholarshipProgramUniversityAgreement, EditarAcuerdoViewModel>(data);

            ViewBag.AgreementTypes = new SelectList(_agreementType.GetAll, "AgreementTypeId", "AgreementTypeName");
            return(View(model));
        }
Ejemplo n.º 13
0
        public IActionResult PerfilUsuarioAdmin(int id)
        {
            var data = _user.GetByID(id);

            var model = CopyPropierties.Convert <User, UserModel>(data);

            ViewBag.UserRole = new SelectList(_userRole.GetAll, "UserRoleId", "UserRoleName");

            return(View(model));
        }
Ejemplo n.º 14
0
        public IActionResult Editar(int id)
        {
            var data = _agentType.GetById(id);

            var model = CopyPropierties.Convert <AgentType, AgentTypeModel>(data);

            ViewBag.Status = new SelectList(_status.Status, "StatusId", "StatusName");

            return(View("Crear", model));
        }
        public IActionResult Editar(int empleadoId)
        {
            var data = _empleado.GetById(empleadoId);

            var model = CopyPropierties.Convert <Empleado, EmpleadoViewModel>(data);


            ViewBag.Posiciones = new SelectList(_posicion.GetAll, "PosicionId", "PosicionName");
            return(View("Crear", model));
        }
Ejemplo n.º 16
0
        public IActionResult Editar(int posicionId)
        {
            var data = _posicion.GetById(posicionId);

            var model = CopyPropierties.Convert <Posicion, PosicionViewModel>(data);



            return(View("Crear", model));
        }
        public IActionResult Editar(int id)
        {
            var data = _scholarshipProgramUniversity.GetById(id);

            var acuerdoProgramasdeBecaModel = CopyPropierties.Convert <ScholarshipProgramUniversity, AcuerdoProgramasdeBecaModel>(data);

            ViewBag.AgreementTypes = new SelectList(_agreementType.GetAll, "AgreementTypeId", "AgreementTypeName");
            ViewBag.Status         = new SelectList(_status.Status, "StatusId", "StatusName");

            return(View("Crear", acuerdoProgramasdeBecaModel));
        }
        public IActionResult GuardarUniverity(UniversityModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Address.Address1) || string.IsNullOrWhiteSpace(model.Communication.CommunicationEmail))
            {
                EnviarMensaje.Enviar(TempData, "red", "Dirección 1  y el Email son requeridos");

                ViewBag.Status      = new SelectList(_status.Status, "StatusId", "StatusName");
                ViewBag.AddressType = new SelectList(_addressType.addressTypes, "AddressTypeId", "AddressTypeName");
                ViewBag.Country     = new SelectList(_country.GetAll, "CountryId", "CountryName");
                ViewBag.Province    = new SelectList(_province.Provinces, "ProvinceId", "ProvinceName");
                ViewBag.City        = new SelectList(_city.Cities, "CityId", "CityName");

                return(View("Crear"));
            }


            if (ModelState.IsValid)
            {
                var university = CopyPropierties.Convert <UniversityModel, University>(model);

                try
                {
                    _university.Save(university);
                }
                catch (Exception e)
                {
                    return(View("Index", _university.Universities));
                }
            }
            else
            {
                var errors = ModelState.Select(x => x.Value.Errors).FirstOrDefault(x => x.Count > 0).First();

                EnviarMensaje.Enviar(TempData, "red", errors.ErrorMessage);


                if (model.UniversityId != null)
                {
                    return(RedirectToAction("Editar", new { id = model.UniversityId }));
                }

                ViewBag.Status      = new SelectList(_status.Status, "StatusId", "StatusName");
                ViewBag.AddressType = new SelectList(_addressType.addressTypes, "AddressTypeId", "AddressTypeName");
                ViewBag.Country     = new SelectList(_country.GetAll, "CountryId", "CountryName");
                ViewBag.Province    = new SelectList(_province.Provinces, "ProvinceId", "ProvinceName");
                ViewBag.City        = new SelectList(_city.Cities, "CityId", "CityName");

                return(View("Crear"));
            }



            return(View("Index", _university.Universities));
        }
        public IActionResult Editar(int id)
        {
            var scholarshipProgramUniversity      = _scholarshipProgramUniversity.GetById(id);
            var scholarshipProgramUniversityModel = CopyPropierties.Convert <ScholarshipProgramUniversity, ScholarshipProgramUniversityModel>(scholarshipProgramUniversity);


            ViewBag.University         = new SelectList(_university.Universities, "UniversityId", "UniversityName");
            ViewBag.Nivel              = new SelectList(_scholarshipLevel.ScholarshipsLevel, "ScholarshipLevelId", "ScholarshipLevelName");
            ViewBag.scholarshipProgram = new SelectList(_scholarshipProgram.GetAll, "ScholarshipProgramId", "ScholarshipProgramName");
            ViewBag.scholarshipProgram = new SelectList(_status.Status, "StatusId", "StatusName");
            return(View("Crear", scholarshipProgramUniversityModel));
        }
Ejemplo n.º 20
0
        public async Task <EditarUsuarioModel> CambiarEstado(string id)
        {
            //code = "12346AASS";

            EditarUsuarioModel editar = new EditarUsuarioModel();

            Usuario user = await _userManager.FindByIdAsync(id);

            var value = CopyPropierties.Convert <Usuario, EditarUsuarioModel>(user);


            return(value);
        }
Ejemplo n.º 21
0
        public IActionResult GuardarTeacher(TeacherModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var data = CopyPropierties.Convert <TeacherModel, Teacher>(model);
                    data.Contact.ContactName           = model.Name;
                    data.Contact.ContactLastname       = model.LastName;
                    data.Contact.ContactDocumentNumber = model.Document;
                    data.Contact.Nationality           = model.Nacionality;
                    _teacher.Save(data);
                }
                catch (Exception e)
                {
                    return(RedirectToAction("Editar", new { id = model.TeacherId }));
                }
            }
            else
            {
                var errors = ModelState.Select(x => x.Value.Errors).FirstOrDefault(x => x.Count > 0).First();



                EnviarMensaje.Enviar(TempData, "red", errors.ErrorMessage);


                if (model.TeacherId != null)
                {
                    return(RedirectToAction("Editar", new { id = model.TeacherId }));
                }


                ViewBag.ContactTypes      = new SelectList(_contactType.GetAll, "ContactTypeId", "ContactTypeName");
                ViewBag.DocumentType      = new SelectList(_documentType.GetAll, "DocumentTypeId", "DocumentTypeName");
                ViewBag.Countries         = new SelectList(_country.GetAll, "CountryId", "CountryName");
                ViewBag.Cities            = new SelectList(_city.Cities, "CityId", "CityName");
                ViewBag.AddressTypes      = new SelectList(_addressType.addressTypes, "AddressTypeId", "AddressTypeName");
                ViewBag.TeacherHiringType = new SelectList(_teacherHiringType.GetAll, "TeacherHiringTypeId", "TeacherHiringTypeName");
                ViewBag.EducationType     = new SelectList(_educationType.GetAll, "EducationTypeId", "EducationTypeName");
                ViewBag.TeacherEducation  = new SelectList(_teacherEducation.GetAll, "TeacherEducationId", "TeacherEducationTitle");
                ViewBag.Nationality       = new SelectList(_nationality.GetAll, "NationalityId", "NationalityName");
                ViewBag.MatirialStatus    = new SelectList(_matirialStatus.GetAll, "MaritalStatusId", "MaritalStatusName");


                return(View("Crear", model));
            }


            return(RedirectToAction("Index", new { UniversityId = model.UniversityId }));
        }
Ejemplo n.º 22
0
        public IActionResult EditarComunicacion(int id)
        {
            var data        = _contactCommunication.GetById(id);
            var model       = CopyPropierties.Convert <ContactCommunication, ContactCommunicationModel>(data);
            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.CommunicationList = _contactCommunication.GetAllByContactId(contactId).ToList();

            return(View(model));
        }
Ejemplo n.º 23
0
        public IActionResult EditarTeacherEducation(int id)
        {
            var data  = _teacherEducation.GetById(id);
            var model = CopyPropierties.Convert <TeacherEducation, TeacherEducationModel>(data);

            var teacherById = _teacher.GetById(id);

            model.TeacherFullName = teacherById.Contact.ContactName + " " + teacherById.Contact.ContactLastname;

            model.TeacherId            = id;
            model.TeacherEducationList = _teacherEducation.GetAll.Where(x => x.TeacherId == id).ToList();
            ViewBag.EducationType      = new SelectList(_educationType.GetAll, "EducationTypeId", "EducationTypeName");
            return(View(model));
        }
Ejemplo n.º 24
0
        public IActionResult Guardar(AgentTypeModel model)
        {
            try
            {
                var data = CopyPropierties.Convert <AgentTypeModel, AgentType>(model);

                _agentType.Save(data);
            }
            catch (Exception e) {
                return(View("Index", _agentType.GetAll));
            }

            return(View("Index", _agentType.GetAll));
        }
Ejemplo n.º 25
0
        public async Task <IActionResult> PerfilUsuario(string id)
        {
            Usuario user = _usuario.GetUsuarioById(id);

            MensajesViewModel mensaje = new MensajesViewModel();
            var userId = _userManager.GetUserId(User);



            if (string.IsNullOrEmpty(id))
            {
                return(View("Login"));
            }

            // 1. traer el usuairo

            //Usuario user = _usuario.GetUsuarioById(id);

            if (user == null)
            {
                //EnviarMensaje.Enviar(TempData, "orange", "Debe de seleccionar una categoría válida!");
                return(View("Login"));
            }

            // 2. Crear el modelo de resset password

            ResetPasswordViewModel rpvm = new ResetPasswordViewModel
            {
                UserName = user.UserName,
                Code     = await _userManager.GeneratePasswordResetTokenAsync(user)
            };

            // 3. crear el modelo de la vista

            var editarUsuarioModel = new EditarUsuarioModel();

            editarUsuarioModel.ImageUrl = "wwwroot/app-assets/images/usuario";

            var model = new PerfilUsuario
            {
                EditarUsuarioModel     = CopyPropierties.Convert <Usuario, EditarUsuarioModel>(user),
                ResetPasswordViewModel = rpvm
            };

            var roles = _role.Roles.ToList();

            ViewBag.Role = new SelectList(roles, "Name", "Name");

            return(View(model));
        }
Ejemplo n.º 26
0
        public IActionResult Editar(int id)
        {
            var data = _scholarshipProgramTracing.GetById(id);

            var model = CopyPropierties.Convert <ScholarshipProgramTracing, ScholarshipProgramTracingModel>(data);


            ViewBag.University = new SelectList(_university.Universities, "UniversityId", "UniversityName");
            //ViewBag.ScholarshipProgramUniversity = new SelectList(_scholarshipProgramUniversity.ScholarshipProgramUniversity, "ScholarshipProgramUniversityId", );
            //ViewBag.ScholarshipProgram = new SelectList(_scholarshipProgramUniversity.ScholarshipProgramUniversity,);
            //ViewBag.Coordinator = new SelectList(_agentType.GetCoordinators, "AgentTypeId", "AgentTypeName");
            //ViewBag.Technical = new SelectList(_agentType.GetTechnicals, "AgentTypeId", "AgentTypeName");
            ViewBag.Status = new SelectList(_status.Status, "StatusId", "StatusName");
            return(View("Crear", model));
        }
Ejemplo n.º 27
0
        public IActionResult Guardar(AgentModel model)
        {
            var data = CopyPropierties.Convert <AgentModel, Agent>(model);

            //try
            //{
            //    _agent.Save(data);
            //}
            //catch(Exception e)
            //{
            //    return View("Index", _agent.Agents);
            //}

            return(View("Index", _agent.Agents));
        }
        public IActionResult GuardarUniverity(UniversityModel model)
        {
            var university = CopyPropierties.Convert <UniversityModel, University>(model);

            try
            {
                _university.Save(university);
            }
            catch (Exception e)
            {
                return(View("Index", _university.Universities));
            }

            return(View("Index", _university.Universities));
        }
        public IActionResult Editar(int id)
        {
            var university = _university.GetById(id);

            var universityModel = CopyPropierties.Convert <University, UniversityModel>(university);


            ViewBag.Status      = new SelectList(_status.Status, "StatusId", "StatusName");
            ViewBag.AddressType = new SelectList(_addressType.addressTypes, "AddressTypeId", "AddressTypeName");
            ViewBag.Country     = new SelectList(_country.GetAll, "CountryId", "CountryName");
            ViewBag.Province    = new SelectList(_province.Provinces, "ProvinceId", "ProvinceName");
            ViewBag.City        = new SelectList(_city.Cities, "CityId", "CityName");

            return(View("Crear", universityModel));
        }
Ejemplo n.º 30
0
        public IActionResult Guardar(SubjectMatterModel model)
        {
            try
            {
                var data = CopyPropierties.Convert <SubjectMatterModel, SubjectMatter>(model);

                _subjectMatter.Save(data);
            }
            catch (Exception e)
            {
                return(View("Index", _subjectMatter.GetAll));
            }

            return(View("Index", _subjectMatter.GetAll));
        }