Пример #1
0
        public override void PopulateEntityDTO(SR.MVCWebSite.StudentsService.StudentDTO item)
        {
            item.Id          = Id;
            item.FirstName   = FirstName;
            item.LastName    = LastName;
            item.Comment     = Comment;
            item.DateOfBirth = DateOfBirth;

            Faculty = new SR.MVCWebSite.StudentsService.FacultyDTO();
            FacultiesClientModel _facService = new FacultiesClientModel();

            SR.MVCWebSite.FacultiesService.FacultyDTO fac = _facService.Service.GetFaculties().Where(x => x.Id == SelectedFaculty).FirstOrDefault();
            Faculty.Id      = fac.Id;
            Faculty.Name    = fac.Name;
            Faculty.City    = fac.City;
            Faculty.Address = fac.Address;
            item.Faculty    = Faculty;

            Nationality = new SR.MVCWebSite.StudentsService.NationalityDTO();
            NationalitiesClientModel _natService = new NationalitiesClientModel();

            SR.MVCWebSite.NationalitiesService.NationalityDTO nat = _natService.Service.GetNationalities().Where(x => x.Id == SelectedNationality).FirstOrDefault();
            Nationality.Id   = nat.Id;
            Nationality.Name = nat.Name;
            item.Nationality = Nationality;
        }
Пример #2
0
        public ActionResult Edit(int id)
        {
            using (_service.Service)
            {
                SR.MVCWebSite.NationalitiesService.NationalityDTO item =
                    _service.Service.GetNationalities().Where(x => x.Id == id).FirstOrDefault();
                EditVM model = new EditVM();
                model.PopulateModel(item);

                return(View(model));
            }
        }
Пример #3
0
 public ActionResult Create(EditVM model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (_service.Service)
             {
                 SR.MVCWebSite.NationalitiesService.NationalityDTO item = new SR.MVCWebSite.NationalitiesService.NationalityDTO();
                 model.PopulateEntityDTO(item);
                 _service.Service.PostNationality(item);
             }
             return(RedirectToAction("Index"));
         }
         return(View());
     }
     catch
     {
         return(View());
     }
 }
 public System.Threading.Tasks.Task <string> PutNationalityAsync(SR.MVCWebSite.NationalitiesService.NationalityDTO natDTO)
 {
     return(base.Channel.PutNationalityAsync(natDTO));
 }
 public string PutNationality(SR.MVCWebSite.NationalitiesService.NationalityDTO natDTO)
 {
     return(base.Channel.PutNationality(natDTO));
 }