Пример #1
0
        public async Task <ActionResult> Edit(string id)
        {
            Adult adult = await adults.GetOneDocument(id);

            AdultViewModel model = new AdultViewModel
            {
                Address        = adult.Address,
                Age            = adult.Age,
                Biomechamical  = adult.Biomechamical,
                BirthDate      = adult.BirthDate,
                CivilStatus    = adult.CivilStatus,
                Contribution   = adult.Contribution,
                CreatedByUser  = adult.CreatedByUser,
                CreationTime   = adult.CreationTime,
                EditedByUser   = adult.EditedByUser,
                EditionTime    = adult.EditionTime,
                EntryReasons   = adult.EntryReasons,
                EntryDate      = adult.EntryDate,
                FirstSurname   = adult.FirstSurname,
                Gender         = adult.Gender,
                Identification = adult.Identification,
                IdCCSS         = adult.IdCCSS,
                Name           = adult.Name,
                Occupation     = adult.Occupation,
                Pension        = adult.Pension,
                SecondSurname  = adult.SecondSurname,
                State          = adult.State,
                Total          = adult.Total
            };

            return(View(model));
        }
Пример #2
0
        public AddAdult_userCntrl(Adult adult, LogIn_AdministratorViewModel logIn_AdministratorVM)
        {
            adultMV          = new AdultViewModel(adult, logIn_AdministratorVM);
            this.DataContext = adultMV;

            InitializeComponent();
            CmbBx_City.ItemsSource = adultMV.cities;
            CmbBx_Street.IsEnabled = false;
        }
Пример #3
0
        //Constructors
        public AddAdult_userCntrl()
        {
            adultMV          = new AdultViewModel();
            this.DataContext = adultMV;

            InitializeComponent();
            CmbBx_City.ItemsSource = adultMV.cities;
            CmbBx_Street.IsEnabled = false;
        }
Пример #4
0
 public ActionResult Create(AdultViewModel modelo)
 {
     if (ModelState.IsValid)
     {
         AdultParameter adultParameter = modelo;
         Adult          employee       = new Adult(adultParameter);
         adults.CreateOneDocument(employee);
         return(RedirectToAction("Index"));
     }
     else
     {
         ModelState.AddModelError("", "Algunos de los campos requeridos no esta presente");
         return(View(modelo));
     }
 }
Пример #5
0
 public ActionResult Edit(string id, AdultViewModel modelo)
 {
     {
         if (ModelState.IsValid)
         {
             AdultParameter adult    = modelo;
             Adult          employee = new Adult(adult);
             adults.UpdateOneDument(id, employee);
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("", "Algunos de los campos requeridos no esta presente");
             return(View(modelo));
         }
     }
 }
Пример #6
0
        public async Task <ActionResult> Details(string id)
        {
            Adult adult = await adults.GetOneDocument(id);

            if (adult != null)
            {
                AdultViewModel model = new AdultViewModel
                {
                    Address        = adult.Address,
                    Age            = adult.Age,
                    Biomechamical  = adult.Biomechamical,
                    BirthDate      = adult.BirthDate,
                    CivilStatus    = adult.CivilStatus,
                    Contribution   = adult.Contribution,
                    CreatedByUser  = adult.CreatedByUser,
                    CreationTime   = adult.CreationTime,
                    EditedByUser   = adult.EditedByUser,
                    EditionTime    = adult.EditionTime,
                    EntryReasons   = adult.EntryReasons,
                    EntryDate      = adult.EntryDate,
                    FirstSurname   = adult.FirstSurname,
                    Gender         = adult.Gender,
                    Identification = adult.Identification,
                    IdCCSS         = adult.IdCCSS,
                    Name           = adult.Name,
                    Occupation     = adult.Occupation,
                    Pension        = adult.Pension,
                    SecondSurname  = adult.SecondSurname,
                    State          = adult.State,
                    Total          = adult.Total
                };

                return(View(model));
            }
            else
            {
                ViewBag.ErrirMessage = "El id de ensayo ingresado no fue encontrado";
                return(View("Error"));
            }
        }
Пример #7
0
        public async Task <ActionResult> Index()
        {
            IEnumerable <Adult> adultList = await adults.GetManyDocumentsAsync();

            List <AdultViewModel> vista = new List <AdultViewModel>();


            foreach (var adult in adultList)
            {
                AdultViewModel model = new AdultViewModel
                {
                    Address        = adult.Address,
                    Age            = adult.Age,
                    Biomechamical  = adult.Biomechamical,
                    BirthDate      = adult.BirthDate,
                    CivilStatus    = adult.CivilStatus,
                    Contribution   = adult.Contribution,
                    CreatedByUser  = adult.CreatedByUser,
                    CreationTime   = adult.CreationTime,
                    EditedByUser   = adult.EditedByUser,
                    EditionTime    = adult.EditionTime,
                    EntryReasons   = adult.EntryReasons,
                    EntryDate      = adult.EntryDate,
                    FirstSurname   = adult.FirstSurname,
                    Gender         = adult.Gender,
                    Identification = adult.Identification,
                    IdCCSS         = adult.IdCCSS,
                    Name           = adult.Name,
                    Occupation     = adult.Occupation,
                    Pension        = adult.Pension,
                    SecondSurname  = adult.SecondSurname,
                    State          = adult.State,
                    Total          = adult.Total
                };

                vista.Add(model);
            }

            return(View(vista));
        }
 public AddAdultCommnd(AdultViewModel myAdultVM)
 {
     this.AdultVM = myAdultVM;
 }