Esempio n. 1
0
        public IActionResult EditClient(int id)
        {
            Client c = dc.getAllClients().FirstOrDefault(c => c.id == id);
            ClientDashboardRegulatedViewModel model = new ClientDashboardRegulatedViewModel(c);

            return(View(model));
        }
Esempio n. 2
0
        public IActionResult EditClient(ClientDashboardRegulatedViewModel model)
        {
            if (ModelState.IsValid)
            {
                Client c = new Client(model);
                dc.updateClient(c);

                return(Redirect("/Home/ManageClients"));
            }

            return(View(model));
        }
Esempio n. 3
0
        public IActionResult CreateClient()
        {
            if (loggedUser == null)
            {
                return(NotFound());
            }
            // if (loggedUser.isAdmin == false) return NotFound();

            ClientDashboardRegulatedViewModel model = new ClientDashboardRegulatedViewModel();

            return(View(model));
        }
        public IActionResult EditClient(int id)
        {
            if (HomeController.loggedUser is null)
            {
                return(NotFound());
            }
            //if (HomeController.loggedUser.isAdmin == false) return NotFound();

            Client c = ds.getFirstEntry <Client>(c => c.id == id);
            ClientDashboardRegulatedViewModel model = new ClientDashboardRegulatedViewModel(c);

            return(View(model));
        }
Esempio n. 5
0
        public IActionResult CreateClient(ClientDashboardRegulatedViewModel model)
        {
            if (loggedUser == null)
            {
                return(NotFound());
            }
            //  if (loggedUser.isAdmin == false) return NotFound();

            if (ModelState.IsValid)
            {
                Client r = new Client(model);
                dc.addClient(r);

                return(RedirectToAction(nameof(ManageClients)));
            }

            return(View(model));
        }
        public IActionResult EditClient(ClientDashboardRegulatedViewModel model)
        {
            if (HomeController.loggedUser is null)
            {
                return(NotFound());
            }
            //if (HomeController.loggedUser.isAdmin == false) return NotFound();

            if (ModelState.IsValid)
            {
                Client c = new Client(model);
                ds.updateEntry(c);

                return(Redirect("/Dashboard/ManageClients"));
            }

            return(View(model));
        }