Exemplo n.º 1
0
 public ActionResult Irasyti(RestrictRightsViewModel model, int clientid)
 {
     if (ModelState.IsValid)
     {
         Darbuotojas emp    = repository.Set <Darbuotojas>().Find(CurrentUser.UserId);
         Viesbutis   hotel  = repository.Set <Viesbutis>().Find(emp.fk_Viesbutisid);
         Teises      rights = repository.Set <Teises>().Where(x => x.viesbuciu_tinklas == hotel.viesbuciu_tinklas && x.fk_Klientaskliento_kodas == clientid).FirstOrDefault();
         rights.priezastis      = model.Reason;
         rights.data_iki        = model.DateEnd;
         rights.teisiu_statusas = false;
         repository.SaveChanges();
     }
     return(RedirectToAction("Sistemos_klientu_langas"));
 }
        public ActionResult Change(int id, int eid)
        {
            Teises right = repository.Set <Teises>().Where(x => x.id == id).FirstOrDefault();

            if (right.teisiu_statusas)
            {
                right.teisiu_statusas = false;
            }
            else
            {
                right.teisiu_statusas = true;
            }
            repository.SaveChanges();
            return(RedirectToAction("Darbuotojo_teisiu_keitimo_langas", new { emplid = eid }));
        }
Exemplo n.º 3
0
        public ActionResult Kliento_informacijos_langas(int id = 0)
        {
            try
            {
                Klientas    client = repository.Set <Klientas>().Find(id);
                Darbuotojas emp    = repository.Set <Darbuotojas>().Find(CurrentUser.UserId);
                Viesbutis   hotel  = repository.Set <Viesbutis>().Find(emp.fk_Viesbutisid);
                Teises      rights = repository.Set <Teises>().Where(x => x.viesbuciu_tinklas == hotel.viesbuciu_tinklas && x.fk_Klientaskliento_kodas == id).FirstOrDefault();
                bool        isRestricted;
                if (rights.data_iki < DateTime.Now)
                {
                    isRestricted = false;
                }
                else
                {
                    isRestricted = true;
                }
                var model = new ClientsViewModel();
                if (client != null)
                {
                    model.id           = client.kliento_kodas;
                    model.Name         = client.vardas;
                    model.Surname      = client.pavarde;
                    model.Email        = client.el_pastas;
                    model.Phone        = client.telefonas;
                    model.Address      = client.adresas;
                    model.Gender       = client.lytis;
                    model.isRestricted = isRestricted;
                }

                return(View(model));
            }
            catch (ITPProException ex)
            {
                return(RedirectToAction("Sistemos_klientu_langas"));
            }
        }