public IHttpActionResult PostPorjectLangauge(PorjectLangauge porjectLangauge) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PorjectLangauges.Add(porjectLangauge); try { db.SaveChanges(); } catch (DbUpdateException) { if (PorjectLangaugeExists(porjectLangauge.ProjectID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = porjectLangauge.ProjectID }, porjectLangauge)); }
public IHttpActionResult PutPorjectLangauge(Guid id, PorjectLangauge porjectLangauge) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != porjectLangauge.ProjectID) { return(BadRequest()); } db.Entry(porjectLangauge).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PorjectLangaugeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetPorjectLangauge(Guid id) { PorjectLangauge porjectLangauge = db.PorjectLangauges.Find(id); if (porjectLangauge == null) { return(NotFound()); } return(Ok(porjectLangauge)); }
public IHttpActionResult DeletePorjectLangauge(Guid id) { PorjectLangauge porjectLangauge = db.PorjectLangauges.Find(id); if (porjectLangauge == null) { return(NotFound()); } db.PorjectLangauges.Remove(porjectLangauge); db.SaveChanges(); return(Ok(porjectLangauge)); }