// 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)); }
// 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)); }