public IHttpActionResult PostLichSuNVGH(LichSuNVGH lichSuNVGH) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LichSuNVGHs.Add(lichSuNVGH); try { db.SaveChanges(); } catch (DbUpdateException) { if (LichSuNVGHExists(lichSuNVGH.MaLS)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = lichSuNVGH.MaLS }, lichSuNVGH)); }
public IHttpActionResult PutLichSuNVGH(int id, LichSuNVGH lichSuNVGH) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != lichSuNVGH.MaLS) { return(BadRequest()); } db.Entry(lichSuNVGH).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LichSuNVGHExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit(LichSuNVGH lichSuNVGH) { HttpResponseMessage response = client.PutAsJsonAsync(url + @"lichsunvgh/" + lichSuNVGH.MaLS, lichSuNVGH).Result; response.EnsureSuccessStatusCode(); return(RedirectToAction("Index")); }
public ActionResult Create(LichSuNVGH lichSuNVGH) { HttpResponseMessage response = client.PostAsJsonAsync(url + @"lichsunvgh/", lichSuNVGH).Result; response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { ViewBag.Detail = "Sucess"; } return(RedirectToAction("Index")); }
// GET: LichSuNVGH/Details/5 public async Task <ActionResult> Details(int?id) { LichSuNVGH lichSuNVGH = null; HttpResponseMessage response = await client.GetAsync(url + @"lichsunvgh/" + id); if (response.IsSuccessStatusCode) { lichSuNVGH = await response.Content.ReadAsAsync <LichSuNVGH>(); } return(View(lichSuNVGH)); }
public IHttpActionResult GetLichSuNVGH(int id) { LichSuNVGH lichSuNVGH = db.LichSuNVGHs.Find(id); if (lichSuNVGH == null) { return(NotFound()); } return(Ok(lichSuNVGH)); }
public IHttpActionResult DeleteLichSuNVGH(int id) { LichSuNVGH lichSuNVGH = db.LichSuNVGHs.Find(id); if (lichSuNVGH == null) { return(NotFound()); } db.LichSuNVGHs.Remove(lichSuNVGH); db.SaveChanges(); return(Ok(lichSuNVGH)); }