// GET: Career/Create public ActionResult Create() { try { CareerController careerController = new CareerController(logger, _iconfiguration); 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"); } 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); } return(View()); }
// 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)); }