/// for add bookandshelve public string Post([FromBody] BookAndShelvecs bookAndShelvecs) { BookAndShelvecs bookAndShelvecs1 = new BookAndShelvecs { IdBook = bookAndShelvecs.IdBook, IdShelf = bookAndShelvecs.IdShelf }; contaxt1.BookAndShelvecs.Add(bookAndShelvecs1); contaxt1.SaveChanges(); return("Okey shod "); }
/// for update public string Put(int id, [FromBody] BookAndShelvecs bookAndShelvecs) { //var xxx = contaxt1.Bookes.Find(id); //var qqq = contaxt1.Shelves.Find(id); //if (xxx==null) //{ // return "this is not exist "; //} //xxx.Publisher = bookAndShelvecs.Booke.Publisher; //xxx.Name = bookAndShelvecs.Booke.Name; //qqq.Name = bookAndShelvecs.shelve.Name; //qqq.id = bookAndShelvecs.shelve.id; //qqq.DateCreate = bookAndShelvecs.shelve.DateCreate; //contaxt1.SaveChanges(); return("Okey shod !!!"); }