public void Post([FromBody] Xr33Item newXr33) { _xr33Repository.InserisciXr33(new Xr33Item { id = newXr33.id, regione = newXr33.regione, provincia = newXr33.provincia }); }
public async Task InserisciXr33(Xr33Item item) { try { await _context.Xr33Items.InsertOneAsync(item); } catch (Exception ex) { // log or manage the exception throw ex; } }
public async Task <bool> AggiornaXr33(Xr33Item item) { var filter = Builders <Xr33Item> .Filter.Eq(s => s.id, item.id); var update = Builders <Xr33Item> .Update .Set(s => s, item); try { UpdateResult actionResult = await _context.Xr33Items.UpdateOneAsync(filter, update); return(actionResult.IsAcknowledged && actionResult.ModifiedCount > 0); } catch (Exception ex) { // log or manage the exception throw ex; } }
public void Put(string id, [FromBody] Xr33Item xr33Upd) { _xr33Repository.AggiornaXr33(xr33Upd); }