Пример #1
0
 public async Task <ActionResult <Leaders> > Post(Leaders leader)
 {
     try
     {
         repository.Add(leader);
         if (await repository.SaveChangesAsync())
         {
             return(Created("", leader));
         }
     }
     catch (Exception e)
     {
         return(this.StatusCode(StatusCodes.Status500InternalServerError, "Post Leader Failure" + e));
     }
     return(BadRequest());
 }
Пример #2
0
 public async Task <ActionResult <Dishes> > Post(Comments comment)
 {
     try
     {
         repository.Add(comment);
         if (await repository.SaveChangesAsync())
         {
             return(Created("", comment));
         }
     }
     catch (Exception e)
     {
         return(this.StatusCode(StatusCodes.Status500InternalServerError, "Post Comment Failure" + e));
     }
     return(BadRequest());
 }