public Comic Get(int id) { using (comicdatabaseEntities entities = new comicdatabaseEntities()) { return(entities.Comic.FirstOrDefault(e => e.id == id)); } }
public IEnumerable <Comic> Get() { using (comicdatabaseEntities entities = new comicdatabaseEntities()) { return(entities.Comic.ToList()); } }
public void Delete(int id) { using (comicdatabaseEntities entities = new comicdatabaseEntities()) { entities.Comic.Remove(entities.Comic.FirstOrDefault(e => e.id == id)); entities.SaveChanges(); } }
public void Post([FromBody] Comic comic) { using (comicdatabaseEntities entities = new comicdatabaseEntities()) { entities.Comic.Add(comic); entities.SaveChanges(); } }
public IEnumerable <Comic> Get(string usr) { using (comicdatabaseEntities entities = new comicdatabaseEntities()) { var usrComics = from Comic comic in entities.Comic where comic.series.Equals(usr) select comic; return(usrComics.ToList <Comic>()); } }
public void Put(int id, [FromBody] Comic comic) { using (comicdatabaseEntities entities = new comicdatabaseEntities()) { var entity = entities.Comic.FirstOrDefault(e => e.id == id); entity.title = comic.title; entity.series = comic.series; entity.issueNumber = comic.issueNumber; entity.publisher = comic.publisher; entities.SaveChanges(); } }