Ejemplo n.º 1
0
        public ActionResult Edit(int id, CareerModel careerModel)
        {
            try
            {
                var url = _iconfiguration.GetValue <string>("WebServices:Career:WebCareerService");
                // TODO: Add update logic here
                WebCareerService.WebCareerServiceSoapClient soapClient = new WebCareerService.WebCareerServiceSoapClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(url));
                // TODO: Add insert logic here
                WebCareerService.CareerDto role = new WebCareerService.CareerDto()
                {
                    CareerId = careerModel.CareerId,
                    Deleted  = careerModel.Deleted,
                    Name     = careerModel.Name,
                    Faculty  = new WebCareerService.FacultyDto()
                    {
                        FacultyId = careerModel.Faculty.FacultyId
                    }
                };
                soapClient.Update(role);

                return(RedirectToAction(nameof(Index)));
            }
            catch (System.Net.Http.HttpRequestException ex)
            {
                _logger.LogCritical(ex.Message);
                _logger.LogCritical(ex.StackTrace);
                return(View());
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex.Message);
                _logger.LogCritical(ex.StackTrace);
                return(View());
            }
        }
Ejemplo n.º 2
0
        // GET: Career/Edit/5
        public ActionResult Edit(int id)
        {
            //ViewData["Edit"] = _localizer["Edit"];
            //ViewData["Person"] = _localizer["Person"];
            //ViewData["Save"] = _localizer["Save"];
            //ViewData["BackToList"] = _localizer["BackToList"];

            CareerController careerController = new CareerController(logger, _iconfiguration);

            WebCareerService.CareerDto caeerDto = null;
            try
            {
                ViewBag.ListCareer = new Microsoft.AspNetCore.Mvc.Rendering.SelectList(
                    (
                        from career in careerController.CareerModel
                        select new SelectListItem
                {
                    Text = career.Name,
                    Value = career.CareerId.ToString()
                }
                    )
                    , "Value", "Text");

                var url = _iconfiguration.GetValue <string>("WebServices:Career:WebCareerService");
                WebCareerService.WebCareerServiceSoapClient soapClient = new WebCareerService.WebCareerServiceSoapClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(url));
                caeerDto = soapClient.GetId(id);
            }
            catch (System.Net.Http.HttpRequestException ex)
            {
                _logger.LogCritical(ex.Message);
                _logger.LogCritical(ex.StackTrace);
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex.Message);
                _logger.LogCritical(ex.StackTrace);
            }

            CareerModel careerModel = new CareerModel()
            {
                CareerId = caeerDto.CareerId,
                Deleted  = caeerDto.Deleted,
                Name     = caeerDto.Name,
                Faculty  = new FacultyModel()
                {
                    FacultyId = caeerDto.Faculty.FacultyId, Name = caeerDto.Faculty.Name, Deleted = caeerDto.Faculty.Deleted
                }
            };

            return(View(careerModel));
        }
Ejemplo n.º 3
0
        // GET: Career/Details/5
        public ActionResult Details(int id)
        {
            //ViewData["Person"] = _localizer["Person"];
            //ViewData["Edit"] = _localizer["Edit"];
            //ViewData["Details"] = _localizer["Details"];
            //ViewData["BackToList"] = _localizer["BackToList"];

            WebCareerService.CareerDto careerDto = null;
            try {
                var url = _iconfiguration.GetValue <string>("WebServices:Career:WebCareerService");
                WebCareerService.WebCareerServiceSoapClient soapClient = new WebCareerService.WebCareerServiceSoapClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(url));
                careerDto = soapClient.GetId(id);
            }
            catch (System.Net.Http.HttpRequestException ex)
            {
                _logger.LogCritical(ex.Message);
                _logger.LogCritical(ex.StackTrace);
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex.Message);
                _logger.LogCritical(ex.StackTrace);
            }

            CareerModel careerModel = new CareerModel()
            {
                CareerId = careerDto.CareerId,
                Deleted  = careerDto.Deleted,
                Name     = careerDto.Name,
                Faculty  = new FacultyModel()
                {
                    FacultyId = careerDto.Faculty.FacultyId, Name = careerDto.Faculty.Name, Deleted = careerDto.Faculty.Deleted
                }
            };

            return(View(careerModel));
        }