Exemple #1
0
        public IActionResult AddApplicationToBook(int bookId, string appIds)
        {
            try
            {
                if (bookId > 0 && !string.IsNullOrEmpty(appIds))
                {
                    int[] ApplicationIds = Array.ConvertAll(appIds.Split(','), int.Parse);
                    var   insertedRows   = _app.AddApplications(bookId, ApplicationIds);
                    var   book           = _app.GetBookForMultipleRelease(bookId);
                    if (insertedRows > 0)
                    {
                        return(Ok($"Inserted ${insertedRows} rows"));

                        _app.SendMailMultipleresourceOnSameDate(book);
                    }
                    else
                    {
                        return(NotFound("Failed to insert"));
                    }
                }
                else
                {
                    _logger.LogError($"Invalid BookId : {bookId} or ApplicationIds : {appIds} in AddApplications");
                    return(BadRequest($"Invalid BookId : {bookId} or ApplicationIds : {appIds}"));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Internal Server Error in AddApplication() : {ex}");
                return(StatusCode(StatusCodes.Status500InternalServerError, "Internal Server Error"));
            }
        }
 public Applications AddApplication(Applications application)
 {
     return(_applicationService.AddApplications(application));
 }