コード例 #1
0
 public ActionResult Delete(int id = -1)
 {
     if (permissionUser.SysAdmin == false)
     {
         throw new Exception("Yetkisiz Erişim!");
     }
     else
     {
         if (id != -1)
         {
             Bolum bolum = _bolumService.GetById(id);
             if (bolum != null)
             {
                 _bolumService.DeleteBolum(bolum);
                 return(RedirectToAction("Index"));
             }
         }
         return(RedirectToAction("Index"));
     }
 }
コード例 #2
0
        public IActionResult Get(int id)
        {
            ServiceResponse <Bolum> response = new ServiceResponse <Bolum>();

            Bolum entity = service.GetById(id);

            if (entity == null)
            {
                response.Errors.Add("Bolum bulunamadı");
                response.HasError = true;
                return(BadRequest(response));
            }
            else
            {
                response.entity       = entity;
                response.IsSuccessful = true;
                return(Ok(response));
            }
        }