public async Task <IActionResult> PutStocks(int id, DataModels.Stocks stocks) { if (id != stocks.StoreId) { return(BadRequest()); } try { var mapaux = _mapper.Map <datamodels.Stocks, data.Stocks>(stocks); new BS.Stocks(_context).Update(mapaux); } catch (Exception ee) { if (!StocksExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <DataModels.Stocks> > PostStocks(DataModels.Stocks stocks) { var mapaux = _mapper.Map <datamodels.Stocks, data.Stocks>(stocks); new BS.Stocks(_context).Insert(mapaux); return(CreatedAtAction("GetStocks", new { id = stocks.StoreId }, stocks)); }