public ActionResult SaveEditedPerdorues(PerdoruesViewModel model)
        {
            AspNetRoles roles = new AspNetRoles();


            using (var db = new taskDb())
            {
                db.AspNetUsers.Add(model.Users);
                db.Entry(model.Users).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                db.AspNetRoles.Where(a => a.Id == model.SelectedRole).FirstOrDefault().AspNetUsers.Add(model.Users);
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult DeletePerdorues(string id)
        {
            using (var db = new taskDb())
            {
                AspNetUsers model = new AspNetUsers();
                model.Id = id;

                db.Entry(model).State = EntityState.Deleted;
                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult SaveNewTip(TipiViewModel model)
        {
            bool True = true;

            using (var db = new taskDb())
            {
                db.spI_tbl_Analize_tip(model.SelectedParent, True, model.EntitetTip.kodi, model.EntitetTip.kodifillim, model.EntitetTip.kodimbarim, model.EntitetTip.kodiaktual, model.EntitetTip.emertimi, model.EntitetTip.pershkrimi, model.EntitetTip.emertimiang, model.EntitetTip.pershkrimiang, model.EntitetTip.rradha, model.EntitetTip.perdorues_id);
                db.SaveChanges();
                int a = db.SelectAllActiveRec_Entitet_tip("tbl_Analize").OrderByDescending(i => i.nrrendor).FirstOrDefault().nrrendor;
                db.spI_tbl_nder_Analize_tip_kategori(model.SelectedParent, a, model.SelectedKategoriId, model.EntitetTip.perdorues_id);
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteTip(string id, string table)
        {
            using (var db = new taskDb())
            {
                var model = new SelectAllActiveRecBySup_Entitet_tip_Result();
                model.aktiv = false;
                var True = true;
                if (table == "Analize")
                {
                    db.spU_tbl_Analize_tip(Convert.ToInt32(id), model.id_sup, True, 1, True, model.kodi, True, model.kodifillim, True, model.kodiaktual, True, model.kodimbarim, True, model.emertimi, True, model.pershkrimi, True, model.emertimiang, True, model.pershkrimiang, True, model.aktiv, True, model.perdorues_id, True);
                }
                else if (table == "Niveli")
                {
                    db.spU_tbl_niveli_tip(model.nrrendor, model.id_sup, True, 1, True, model.kodi, True, model.kodifillim, True, model.kodiaktual, True, model.kodimbarim, True, model.emertimi, True, model.pershkrimi, True, model.emertimiang, True, model.pershkrimiang, True, model.aktiv, True, model.perdorues_id, True);
                }

                else if (table == "Klient")
                {
                    db.spU_tbl_klient_tip(model.nrrendor, model.id_sup, True, 1, True, model.kodi, True, model.kodifillim, True, model.kodiaktual, True, model.kodimbarim, True, model.emertimi, True, model.pershkrimi, True, model.emertimiang, True, model.pershkrimiang, True, model.aktiv, True, model.perdorues_id, True);
                }
                else if (table == "Personel")
                {
                    db.spU_tbl_personel_tip(model.nrrendor, model.id_sup, True, 1, True, model.kodi, True, model.kodifillim, True, model.kodiaktual, True, model.kodimbarim, True, model.emertimi, True, model.pershkrimi, True, model.emertimiang, True, model.pershkrimiang, True, model.aktiv, True, model.perdorues_id, True);
                }
                else if (table == "Pyetje")
                {
                    db.spU_tbl_pyetje_tip(model.nrrendor, model.id_sup, True, 1, True, model.kodi, True, model.kodifillim, True, model.kodiaktual, True, model.kodimbarim, True, model.emertimi, True, model.pershkrimi, True, model.emertimiang, True, model.pershkrimiang, True, model.aktiv, True, model.perdorues_id, True);
                }
                else if (table == "Project")
                {
                    db.spU_tbl_project_tip(model.nrrendor, model.id_sup, True, 1, True, model.kodi, True, model.kodifillim, True, model.kodiaktual, True, model.kodimbarim, True, model.emertimi, True, model.pershkrimi, True, model.emertimiang, True, model.pershkrimiang, True, model.aktiv, True, model.perdorues_id, True);
                }
                else if (table == "Skeda")
                {
                    db.spU_tbl_skeda_tip(model.nrrendor, model.id_sup, True, 1, True, model.kodi, True, model.kodifillim, True, model.kodiaktual, True, model.kodimbarim, True, model.emertimi, True, model.pershkrimi, True, model.emertimiang, True, model.pershkrimiang, True, model.aktiv, True, model.perdorues_id, True);
                }
                else if (table == "Task")
                {
                    db.spU_tbl_task_tip(model.nrrendor, model.id_sup, True, 1, True, model.kodi, True, model.kodifillim, True, model.kodiaktual, True, model.kodimbarim, True, model.emertimi, True, model.pershkrimi, True, model.emertimiang, True, model.pershkrimiang, True, model.aktiv, True, model.perdorues_id, True);
                }
                else if (table == "Teknologji")
                {
                    db.spU_tbl_teknologjia_tip(model.nrrendor, model.id_sup, True, 1, True, model.kodi, True, model.kodifillim, True, model.kodiaktual, True, model.kodimbarim, True, model.emertimi, True, model.pershkrimi, True, model.emertimiang, True, model.pershkrimiang, True, model.aktiv, True, model.perdorues_id, True);
                }
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }