Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
684 B
2
Indexable
Never
IRepository.cs
 public Task<string> GetDescription(string title);

Repository.cs
public async Task<string> GetDescription(string title){
       
           var blogDescrition = await _context.Blogs.Where(x=>x.BlogTitle==title)
           .Select(x=>x.BlogDescription).FirstOrDefaultAsync();
            return blogDescrition;
           
     
   }

BlogController.cs
  [HttpGet("GetDescription")]
       public async Task<ActionResult<string>> GetDescription([FromQuery]string title){
           var b=await _blogRepository.GetDescription(title);
           if(b==null){
               return NotFound("Errorrrr");
           }else{
               return Ok(b);
           }
       }
Leave a Comment