예제 #1
0
        public async Task <IActionResult> InsertRichieste([FromBody] RichiesteDto richiesteDto)
        {
            try
            {
                // Retreiving the newly created richieste object from bll.
                var categories = await _richiesteManager.InsertAsync(User, richiesteDto);

                // Null Exception handling code block
                if (categories == null)
                {
                    return(NotFound());
                }
                // creating the azioni object passing the related details and description.
                var azioniDto = _utilityManager.GetAzioniDtoObject(User, "add", "richieste");
                // logging the activity record by the user.
                await _azioniManager.AzioniInsert(azioniDto);

                return(Ok());
            }
            catch (Exception x)
            {
                // Code block of Exception handling and logging into log_operazione table.
                var errorObj = await _utilityManager.ReturnErrorObj(x, User, "Insert new Richieste");

                // Returning the error object.
                return(BadRequest(errorObj));
            }
        }