public ActionResult <Shelvesdto> Post(string id) { var db = new DataContext(); Guid idguid = Guid.Parse(id); Bookdto book = GetBooks(idguid); if (!book.Equals(null)) { List <Shelvesdto> shelves = null; Shelvesdto shelve = new Shelvesdto(book.Id, book.Title); shelves.Add(shelve); // Create Console.WriteLine("Inserting a new book"); db.Add(shelve); db.SaveChanges(); // Read Console.WriteLine("Querying for a blog"); var Book = db.Book .OrderBy(b => b.Id) .First(); return(Ok(shelve)); } return(NotFound()); }
public ActionResult <Shelvesdto> GetShelves(string id) { SQLiteDataReader ID = null; Guid idguid = Guid.Parse(id); var shelve = _shelveService.Getshelvess(idguid); if (shelve is null) { var a = GetBooks(idguid); shelve = new Shelvesdto(a.Id, a.Title); } return(shelve); }
public void AddEntity(Shelvesdto entity) { _context.Shelves.Add(entity); _context.SaveChanges(); }