コード例 #1
0
        public IActionResult Delete([FromRoute] int id)
        {
            try
            {
                WarnignCore warnignsCore = new WarnignCore(dbContext);

                warnignsCore.Delete(id);

                return(Ok("warnig Word Deleted Succesfully"));
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
            }
        }
コード例 #2
0
        public IActionResult Create([FromBody] Warning warning)
        {
            try
            {
                WarnignCore warnignsCore = new WarnignCore(dbContext);

                warnignsCore.Create(warning);

                return(Ok("warning Word Added Succesfully"));
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
            }
        }
コード例 #3
0
 public IActionResult GetAll()
 {
     /*
      *  //List<BlockedWord> blockedWords = dbContext.BlockedWord.ToList();
      *
      * LINQ Examples
      *
      * //List<BlockedWord> blockedWords = dbContext.BlockedWord.Where(blockedWord => bldockedWord.Id > 1).ToList();
      *
      *
      * // return blockedWords;
      *
      */
     try
     {
         WarnignCore warnignsCore = new WarnignCore(dbContext);
         return(Ok(warnignsCore.GetAll()));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
     }
 }