public async Task <ActionResult <VAS> > PostVAS(VAS vAS) { _context.VAS.Add(vAS); await _context.SaveChangesAsync(); return(CreatedAtAction("GetVAS", new { id = vAS.Id }, vAS)); }
public async Task <IActionResult> PutVAS(int id, VAS vAS) { if (id != vAS.Id) { return(BadRequest()); } _context.Entry(vAS).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VASExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create(VAS request) { if (!ModelState.IsValid) { return(View()); } var result = await _vasApiClient.Create(request); if (result) { TempData["result"] = "Successful"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Something went wrong !"); return(View(request)); }
public async Task <bool> Edit(int id, VAS vas) { var json = JsonConvert.SerializeObject(vas); var httpContent = new StringContent(json, Encoding.UTF8, "application/json"); var client = _httpClientFactory.CreateClient(); client.BaseAddress = new Uri("https://localhost:5001"); var response = await client.PutAsync($"/api/VAS/{id}", httpContent); var body = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { return(true); } return(false); }
public async Task <ActionResult> Edit(VAS request) { var result = await _vasApiClient.Edit(request.Id, request); return(RedirectToAction("Index", "VAS")); }
static void RenderTeam(IDrawingToolkit tk, VAS.Core.Store.Templates.Team team, Point imagePoint) { tk.DrawImage (imagePoint, StyleConf.ListImageWidth, StyleConf.ListImageWidth, team.Shield, ScaleMode.AspectFit); }