public override async Task <ActionResult> Create() { var modelView = new CrearUsuarioViewModel(); modelView.Roles = new ReadOnlyCollection <RolDto>(await RolService.GetAll()); modelView.Modulos = new ReadOnlyCollection <ModuloDto>(await ModuloService.GetAll()); modelView.Model = new CrearUsuarioDto() { Estado = EstadoUsuario.Activo }; return(View(modelView)); }
public IActionResult GetAll() { var roles = _rolService.GetAll(); var model = _mapper.Map <IList <RolModel> >(roles); return(Ok(model)); }
public async Task <IActionResult> RolDuzenle(int rolId, string rolAd, int durum, int rolYetki, string kayitTarihi, int ekleyenId) { try { if (rolAd == null) { throw new RequiredFieldsException("Rol adı boş geçilemez"); } var roller = _rolService.GetAll().Where(r => r.rol_adi == rolAd).ToList(); if (roller.Count > 1) { throw new Exception("Bu rol adı zaten kayıtlı"); } else { var identityUser = await _userManager.GetUserAsync(HttpContext.User); Rol updatedRol = new Rol { id = rolId, ekleyen_id = ekleyenId, guncelleyen_id = identityUser.uyeDetayId, rol_adi = rolAd, rol_guncelleme_tarihi = DateTime.Now, rol_kayit_tarihi = Convert.ToDateTime(kayitTarihi), sil_id = durum, yetki_id = rolYetki }; _rolService.UpdateRol(updatedRol); TempData["Sonuc"] = "Rol başarıyla güncellendi"; } } catch (Exception ex) { TempData["Exception"] = ex.Message; } return(RedirectToAction("RolListesi")); }
public IActionResult Index(int kullaniciId) { _entityListModel = new EntityListModel { kullanicilar = _uyedetayService.GetAll(), dersler = _dersService.GetAll(), roller = _rolService.GetAll(), sinavlar = _sinavService.GetAll(), temalar = _temaService.GetAll(), yetkiler = _yetkiService.GetAll(), AdminID = kullaniciId }; return(View(_entityListModel)); }
public async Task <IActionResult> KullaniciListesi() { var userDetails = _uyeService.GetAllUserDetail(); _entityListModel = new EntityListModel { UserDetails = userDetails, roller = _rolService.GetAll(), senkron = new List <SenkronizasyonModel>() }; foreach (var user in userDetails) { var identity = await _userManager.FindByNameAsync(user.kullanici_adi); if (identity == null) { _model = new SenkronizasyonModel { senkronUsername = user.kullanici_adi, senkron = 0 }; _entityListModel.senkron.Add(_model); } else { _model = new SenkronizasyonModel { senkronUsername = user.kullanici_adi, senkron = 1 }; _entityListModel.senkron.Add(_model); } } if (TempData["Exception"] != null) { ViewBag.Exceptions = TempData["Exception"].ToString(); } if (TempData["Sonuc"] != null) { ViewBag.Message = TempData["Sonuc"].ToString(); } return(View(_entityListModel)); }
public ActionResult Get() { return(Ok( rolService.GetAll() )); }
public IActionResult GetAll(RolModel model) { return(Ok(_rolService.GetAll(model))); }
public async Task <IActionResult> GetAll() { var result = await _rolService.GetAll(); return(Ok(result)); }
public ApiResultModel <List <ROL> > GetAll() => GetApiResultModel(() => _rolService.GetAll <ROL>());