public async Task <IActionResult> Putds_Size([FromRoute] int id, [FromBody] ds_Size ds_Size) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ds_Size.id) { return(BadRequest()); } _context.Entry(ds_Size).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ds_SizeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Edit(int id, [Bind("id,VN,US,UK,Inch,Centimet,id_Depart")] ds_Size ds_Size) { if (String.IsNullOrEmpty(HttpContext.Session.GetInt32("idAdmin").ToString())) { return(RedirectToAction("Index", "Login")); } if (id != ds_Size.id) { return(NotFound()); } if (ModelState.IsValid) { try { var result = await _api.putAPI(ds_Size, $"api/ds_SizeChange/{id}", HttpContext.Session.GetString("token")); } catch (DbUpdateConcurrencyException) { if (!ds_SizeExists(ds_Size.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(ds_Size)); }
public async Task <IActionResult> Postds_Size([FromBody] ds_Size ds_Size) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ds_Size.Add(ds_Size); await _context.SaveChangesAsync(); return(CreatedAtAction("Getds_Size", new { id = ds_Size.id }, ds_Size)); }
public IActionResult Create([Bind("VN,US,UK,Inch,Centimet,id_Depart")] ds_Size ds_Size) { if (String.IsNullOrEmpty(HttpContext.Session.GetInt32("idAdmin").ToString())) { return(RedirectToAction("Index", "Login")); } if (_api.postAPI(ds_Size, "api/ds_SizeChange", HttpContext.Session.GetString("token")).Result) { IEnumerable <ds_Size> result = JsonConvert.DeserializeObject <List <ds_Size> >(_api.getAPI("api/ds_SizeAPI", HttpContext.Session.GetString("token")).Result); return(RedirectToAction(nameof(Index))); } return(View(ds_Size)); }