示例#1
0
 public (JsonResult result, bool Succeeded) InsertBlogDesc(BlogDesc blogdesc)
 {
     try
     {
         var entity = new BlogDescription
         {
             BlogID      = blogdesc.BlogID,
             Description = blogdesc.Description,
             StatusID    = blogdesc.StatusID
         };
         _context.BlogDescriptions.Add(entity);
         if (_context.SaveChanges() == 1)
         {
             return(new JsonResult("Blog Description added successfully."), true);
         }
         else
         {
             return(new JsonResult("Enter the correct values."), false);
         }
     }
     catch (Exception ex)
     {
         return(new JsonResult("Some server error occured. Please try again!!"), false);
     }
 }
示例#2
0
 public IActionResult InsertBlogDesc(BlogDesc blogdesc)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest("Enter the correct values"));
     }
     var(result, succeeded) = _commonServices.InsertBlogDesc(blogdesc);
     if (succeeded)
     {
         return(Ok(result));
     }
     return(BadRequest(result));
 }