public ActionResult KullaniciRolDuzenle(int id) { var kullanici = kullaniciServis.Bul(id); var secilenRoller = kullanici.Roller.Select(x => x.Id).ToArray(); KullaniciRolModel model = new KullaniciRolModel { Kullanici = kullanici, Roller = rolServis.Roller(), SecilenRoller = secilenRoller }; return(View(model)); }
public ActionResult RollerJson(int page, int rows, string sort, string order) { var roller = rolServis.Roller(); int pageIndex = page - 1; int pageSize = rows; int totalRecords = roller.Count(); int totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize); var result = new { total = totalRecords, rows = roller.Select(x => new { Id = x.Id, Ad = x.Ad }) .AsQueryable() .OrderBy(sort + " " + order) .Skip(pageIndex * pageSize) .Take(pageSize) .ToList() }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult RollerJson(int page, int rows, string sort, string order) { var roller = rolServis.Roller(page, rows); var result = new { total = roller.KayitSayisi, rows = roller.KaynakListe.Select(x => new { Id = x.Id, Ad = x.Ad }) .AsQueryable() .OrderBy(sort + " " + order) }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult KullaniciRolEkle(int id) { var kullanici = kullaniciServis.KullaniciBul(id); var roller = rolServis.Roller(); KullaniciRolViewModel model = new KullaniciRolViewModel(); model.KullaniciId = kullanici.Id; foreach (var rol in roller) { model.Roller.Add(new RolViewModel { RoleSahip = kullanici.Roller.Any(r => r.Id == rol.Id), Id = rol.Id, RolAdi = rol.Ad }); } return(View(model)); }