public async Task <ActionResult <int> > PostDetale(Detale detale) { _context.Detales.Add(detale); await _context.SaveChangesAsync(); //return CreatedAtAction("GetDetale", new { id = detale.Id }, detale); return(Ok(detale.Id)); }
public async Task <IActionResult> PutDetale(Detale detale) { ////if (id != detale.Id) ////{ //// return BadRequest(); ////} var entity = await _context.Detales.FirstOrDefaultAsync(e => e.Id == detale.Id); if (entity is null) { return(BadRequest()); } entity.KilmesSalis = detale.KilmesSalis; entity.PagaminimoData = detale.PagaminimoData; entity.Pavadinimas = detale.Pavadinimas; entity.Savikaina = detale.Savikaina; entity.SerijosNumeris = detale.SerijosNumeris; entity.TelefonoModelisId = detale.TelefonoModelisId; _context.Entry(entity).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DetaleExists(detale.Id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <HttpResponseMessage> UpdateDetaleAsync(string baseUrl, Detale detale) { var a = await _client.PutAsync($"{baseUrl}api/DetaliuUzsakymo/", RequestHelper.GetStringContentFromObject(detale)); return(a); }
public async Task <int> InsertDetaleAsync(string baseUrl, Detale detale) { var response = await _client.PostAsync($"{baseUrl}api/DetaliuUzsakymo/", RequestHelper.GetStringContentFromObject(detale)); return(Convert.ToInt32(response.Content.ReadAsStringAsync().Result)); }