Пример #1
0
        public IActionResult InsertPortifolio([FromBody] Portifolio portifolio)
        {
            try
            {
                portifolio.Fotos = portifolio.Fotos.Select(x => new FotoPortifolio(x.Foto, portifolio.IdPortifolio)).ToList();
                Portifolio.Save(portifolio);

                return(new JsonResult("Portifólio Incluído!"));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #2
0
        public IActionResult UpdatePortifolio([FromBody] Portifolio portifolio)
        {
            try
            {
                portifolio.Fotos.Where(x => x.IdPortifolio == 0).Select(x => x.IdPortifolio = portifolio.IdPortifolio);
                Portifolio.Save(portifolio);

                return(new JsonResult("Portifólio Editado!"));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }