예제 #1
0
 public void Post([FromBody] Xr33Item newXr33)
 {
     _xr33Repository.InserisciXr33(new Xr33Item
     {
         id        = newXr33.id,
         regione   = newXr33.regione,
         provincia = newXr33.provincia
     });
 }
예제 #2
0
 public async Task InserisciXr33(Xr33Item item)
 {
     try
     {
         await _context.Xr33Items.InsertOneAsync(item);
     }
     catch (Exception ex)
     {
         // log or manage the exception
         throw ex;
     }
 }
예제 #3
0
        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;
            }
        }
예제 #4
0
 public void Put(string id, [FromBody] Xr33Item xr33Upd)
 {
     _xr33Repository.AggiornaXr33(xr33Upd);
 }