public async Task <IActionResult> KuvvetBul(int kuvvetBulId) { BaseResponce <Kuvvet> kuvvetResponce = await KuvvetGenericService.GetById(kuvvetBulId); if (kuvvetResponce.Success) { return(Ok(kuvvetResponce.Extra)); } else { return(BadRequest(kuvvetResponce.ErrorMessage)); } }
public async Task <IActionResult> MalzemeKayitSil(int MalzemeKayitId) { BaseResponce <MalzemeTablosu> malzemeKayitResponce = await MalzemeTablosuGenericService.Delete(MalzemeKayitId); if (malzemeKayitResponce.Success) { return(Ok(malzemeKayitResponce.Extra)); } else { return(BadRequest(malzemeKayitResponce.ErrorMessage)); } }
public IActionResult RemoveRefreshToken(TokenResource tokenResource) { BaseResponce <AccessToken> accessTokenResponce = authenticationService.RevokeRefreshToken(tokenResource.RefreshToken); if (accessTokenResponce.Success) { return(Ok(accessTokenResponce.Extra)); } else { return(BadRequest(accessTokenResponce.ErrorMessage)); } }
public async Task <IActionResult> BagliBirlikListele() { BaseResponce <IEnumerable <BagliBirlik> > bagliBirlikListResponce = await bagliBirlikGenericService.GetWhere(x => x.BirlikId > 0); if (bagliBirlikListResponce.Success) { return(Ok(bagliBirlikListResponce.Extra)); } else { return(BadRequest(bagliBirlikListResponce.ErrorMessage)); } }
public async Task <IActionResult> KuvvetListele() { BaseResponce <IEnumerable <Kuvvet> > kuvvetListResponce = await KuvvetGenericService.GetWhere(x => x.KuvvetId > 0); if (kuvvetListResponce.Success) { return(Ok(kuvvetListResponce.Extra)); } else { return(BadRequest(kuvvetListResponce.ErrorMessage)); } }
public BaseResponce <AccessToken> RevokeRefreshToken(string refreshToken) { BaseResponce <PersonelTablosu> personelResponce = personelService.RefreshTokenilePersoneliGetir(refreshToken); if (personelResponce.Success) { personelService.RefreshTokenSil(personelResponce.Extra); return(new BaseResponce <AccessToken>(new AccessToken())); } else { return(new BaseResponce <AccessToken>("Refresh Token Bulunamadı")); } }
public IActionResult PersonelEkle(PersonelResource personelTablosu) { PersonelTablosu personel = mapper.Map <PersonelResource, PersonelTablosu>(personelTablosu); BaseResponce <PersonelTablosu> personelResponce = personelService.UserEkle(personel); if (personelResponce.Success) { return(Ok(personelResponce.Extra)); } else { return(BadRequest(personelResponce.ErrorMessage)); } }
public BaseResponce <AccessToken> CreateAccessToken(string email, string password) { BaseResponce <PersonelTablosu> personelResponce = personelService.EmailvePasswordAra(email, password); if (personelResponce.Success) { AccessToken accessToken = tokenHendler.CreateAccessToken(personelResponce.Extra); personelService.RefreshTokenKaydet(personelResponce.Extra.PersonelId, accessToken.RefreshToken); return(new BaseResponce <AccessToken>(accessToken)); } else { return(new BaseResponce <AccessToken>(personelResponce.ErrorMessage)); } }
public IActionResult PersonelleriGetir() { IEnumerable <Claim> claims = User.Claims; string personelID = claims.Where(c => c.Type == ClaimTypes.NameIdentifier).First().Value; BaseResponce <PersonelTablosu> personelResponce = personelService.IdBul(int.Parse(personelID)); if (personelResponce.Success) { return(Ok(personelResponce.Extra)); } else { return(BadRequest(personelResponce.ErrorMessage)); } }
public IActionResult AccessToken(LoginResource loginResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.HataMesajlariniGetir())); } else { BaseResponce <AccessToken> accessTokenResponce = authenticationService.CreateAccessToken(loginResource.EMail, loginResource.Password); if (accessTokenResponce.Success) { return(Ok(accessTokenResponce.Extra)); } else { return(BadRequest(accessTokenResponce.ErrorMessage)); } } }
public async Task <IActionResult> KuvvetGuncelle(KuvvetResource kuvvetResource, int kuvvetGuncelleId) { if (!ModelState.IsValid) { return(Ok(ModelState.HataMesajlariniGetir())); } else { Kuvvet kuvvet = mapper.Map <KuvvetResource, Kuvvet>(kuvvetResource); kuvvet.KuvvetId = kuvvetGuncelleId; BaseResponce <Kuvvet> kuvvetResponce = await KuvvetGenericService.Update(kuvvet); if (kuvvetResponce.Success) { return(Ok(kuvvetResponce.Extra)); } else { return(BadRequest(kuvvetResponce.ErrorMessage)); } } }
public BaseResponce <AccessToken> CreateAccessTokenByRefreshToken(string refreshToken) { BaseResponce <PersonelTablosu> personelResponce = personelService.RefreshTokenilePersoneliGetir(refreshToken); if (personelResponce.Success) { if (personelResponce.Extra.RefreshTokenEndDate > DateTime.Now) { AccessToken accessToken = tokenHendler.CreateAccessToken(personelResponce.Extra); personelService.RefreshTokenKaydet(personelResponce.Extra.PersonelId, accessToken.RefreshToken); return(new BaseResponce <AccessToken>(accessToken)); } else { return(new BaseResponce <AccessToken>("RefreshToken Süresi Dolmuş")); } } else { return(new BaseResponce <AccessToken>("Refresh Token Bulunamadı")); } }
public async Task <IActionResult> BagliBirlikEkle(BagliBirlikResource bagliBirlikResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.HataMesajlariniGetir())); } else { BagliBirlik bagliBirlik = mapper.Map <BagliBirlikResource, BagliBirlik>(bagliBirlikResource); BaseResponce <BagliBirlik> bagliBirlikResponce = await bagliBirlikGenericService.Add(bagliBirlik); if (bagliBirlikResponce.Success) { return(Ok(bagliBirlikResponce.Extra)); } else { return(BadRequest(bagliBirlikResponce.ErrorMessage)); } } }