Beispiel #1
0
        public JsonResult Sil(int id)
        {
            Kullanici k = _kullaniciRepository.GetByID(id);

            if (k == null)
            {
                return(Json(new ResultJson {
                    Success = false, Message = "Kullanıcı bulunamadı"
                }));
            }
            try
            {
                _kullaniciRepository.Delete(id);
                _kullaniciRepository.Save();
                return(Json(new ResultJson {
                    Success = true, Message = "Kullanıcı başarıyla silindi"
                }));
            }
            catch (Exception)
            {
                return(Json(new ResultJson {
                    Success = false, Message = "Bir hata oluştu"
                }));
            }
        }
Beispiel #2
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                if (await _kullanici.GetById(id) != null)
                {
                    await _kullanici.Delete(id);

                    await _log.Add(new Log()
                    {
                        DurumId      = 1,
                        IslemTipId   = 4,
                        Aciklama     = id + " Id'li Kullanıcı Silindi",
                        KullaniciId  = Convert.ToInt32(Request.Headers["current-user-id"]),
                        KullaniciAdi = Request.Headers["current-user-name"],
                        Tarih        = DateTime.Now,
                        IP           = Request.Headers["ip-address"]
                    });

                    return(Ok()); //200
                }
                else
                {
                    await _log.Add(new Log()
                    {
                        DurumId      = 2,
                        IslemTipId   = 4,
                        Aciklama     = id + " Id'li Kullanıcı Silinemedi",
                        KullaniciId  = Convert.ToInt32(Request.Headers["current-user-id"]),
                        KullaniciAdi = Request.Headers["current-user-name"],
                        Tarih        = DateTime.Now,
                        IP           = Request.Headers["ip-address"]
                    });

                    return(NotFound());
                }
            }
            catch (System.Exception)
            {
                await _log.Add(new Log()
                {
                    DurumId      = 2,
                    IslemTipId   = 4,
                    Aciklama     = "Kullanıcı Servisinde Silme Hatası Oluştu!",
                    KullaniciId  = Convert.ToInt32(Request.Headers["current-user-id"]),
                    KullaniciAdi = Request.Headers["current-user-name"],
                    Tarih        = DateTime.Now,
                    IP           = Request.Headers["ip-address"]
                });

                return(NotFound());
            }
        }
Beispiel #3
0
        public ActionResult Sil(int id)
        {
            Kullanici kullanici = _kullaniciRepository.GetById(id);

            if (kullanici == null)
            {
                TempData["Bilgi"] = "Kullanıcı bulunamadı!";
            }
            _kullaniciRepository.Delete(id);
            _kullaniciRepository.Save();
            TempData["Bilgi"] = "Kullanıcı başarıyla silindi";
            return(RedirectToAction("Index", "Kullanici"));
        }
        public JsonResult Sil(kullanici kullanici_)
        {
            kullanici dbKullanici = _kullaniciRepository.GetById(kullanici_.ID);

            if (dbKullanici == null)
            {
                return(Json(new ResultJson {
                    Success = false, Message = "Kullanıcı Bulunamadı !"
                }));
            }

            try
            {
                if (dbKullanici != null)
                {
                    string   Resim     = dbKullanici.Foto;
                    string   resimPath = Server.MapPath(Resim);
                    FileInfo files     = new FileInfo(resimPath);
                    if (files.Exists)
                    {
                        files.Delete();
                    }
                }
                _kullaniciRepository.Delete(kullanici_.ID);
                _kullaniciRepository.Save();
                return(Json(new ResultJson {
                    Success = true, Message = "Kullanıcı Silme işlemi Başarılı"
                }));
            }
            catch (Exception)
            {
                return(Json(new ResultJson {
                    Success = false, Message = "Kullanıcı Silme İşlemi Sırasında Bir Hata Oluştu !"
                }));
            }
        }
        public JsonResult Sil(int ID)
        {
            Kullanici dbKullanici = _kullaniciRepository.GetById(ID);
            var       gelenID     = Convert.ToInt32(Session["KullaniciEmail"]);

            if (ID == gelenID)
            {
                return(Json(new ResultJson {
                    Success = false, Message = "Oturum Açmış Olduğunuz Kullanıcı Silinemez !"
                }));
            }
            if (dbKullanici == null)
            {
                return(Json(new ResultJson {
                    Success = true, Message = "Kullanıcı Bulunamadı"
                }));
            }
            _kullaniciRepository.Delete(ID);
            _kullaniciRepository.Save();

            return(Json(new ResultJson {
                Success = true, Message = "Kullanıcı Silme İşleminiz Başarılı"
            }));
        }
 public async Task Delete(int id, int firmaid)
 {
     await _kullaniciRepository.Delete(id, firmaid);
 }
 public void Delete(int id)
 {
     _kullaniciRepository.Delete(id);
 }