Ejemplo n.º 1
0
        public async Task <ActionResult <IEnumerable <Song> > > Post()
        {
            Song song = new Song();

            try { song = await ConvertForm(Request.Form); }
            catch (Exception)
            {
                return(Problem("exeption while  uploading song"));
            }
            try
            {
                if (_checker.IsObjectComplete(song, true))
                {
                    await _adminService.Add(song);
                }
                else
                {
                    _logger.LogError("invalid song tried to be added");
                    return(Problem("invalid song tried to be added"));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "exeption while adding song");
                return(Problem("exeption while adding song"));
            }
            return(InnerGet());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <Note> > > Post(Note note)
        {
            try
            {
                if (_checker.IsObjectComplete(note, true))
                {
                    await _adminService.Add(note);
                }
                else
                {
                    _logger.LogError("invalid note tried to be added");
                    return(Problem("invalid note tried to be added"));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "exeption while adding note");
                return(Problem("exeption while adding note"));
            }

            return(InnerGet());
        }
        public async Task <ActionResult <IEnumerable <Spotlight> > > Post([FromBody] Spotlight spotlight)
        {
            try
            {
                if (_checker.IsObjectComplete(spotlight, true))
                {
                    await _adminService.Add(spotlight);
                }
                else
                {
                    _logger.LogError("invalid spotlight tried to be added");
                    return(Problem("invalid spotlight tried to be added"));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "exeption while adding spotlight");
                return(Problem("exeption while adding spotlight"));
            }

            return(InnerGet());
        }