Esempio n. 1
0
 public Comic Get(int id)
 {
     using (comicdatabaseEntities entities = new comicdatabaseEntities())
     {
         return(entities.Comic.FirstOrDefault(e => e.id == id));
     }
 }
Esempio n. 2
0
 public IEnumerable <Comic> Get()
 {
     using (comicdatabaseEntities entities = new comicdatabaseEntities())
     {
         return(entities.Comic.ToList());
     }
 }
Esempio n. 3
0
 public void Delete(int id)
 {
     using (comicdatabaseEntities entities = new comicdatabaseEntities())
     {
         entities.Comic.Remove(entities.Comic.FirstOrDefault(e => e.id == id));
         entities.SaveChanges();
     }
 }
Esempio n. 4
0
 public void Post([FromBody] Comic comic)
 {
     using (comicdatabaseEntities entities = new comicdatabaseEntities())
     {
         entities.Comic.Add(comic);
         entities.SaveChanges();
     }
 }
Esempio n. 5
0
 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>());
     }
 }
Esempio n. 6
0
 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();
     }
 }