public string  Post([FromBody] Booke booke)
        {
            Booke booke1 = new Booke
            {
                Name      = booke.Name,
                Publisher = booke.Publisher
            };

            _context.Bookes.Add(booke1);
            _context.SaveChanges();
            return("The book is saved ");
        }
Example #2
0
        public string  Post([FromBody] Shelve shelve)
        {
            Shelve shelve1 = new Shelve
            {
                Name       = shelve.Name,
                DateCreate = shelve.DateCreate,
                iduser     = shelve.iduser
            };

            contaxt1.Shelves.Add(shelve1);
            contaxt1.SaveChanges();
            return("its Okey !!");
        }
        public string Register([FromBody] User user)
        {
            if (_contaxt.Users.Any(x => x.UserName == user.UserName))
            {
                return("This user is exist ");
            }

            User user1 = new User
            {
                UserName = user.UserName,
                Name     = user.Name,
                Addres   = user.Addres,
                Password = user.Password
            };

            _contaxt.Users.Add(user1);
            _contaxt.SaveChanges();
            return("register is okey !!!");
        }
Example #4
0
        /// 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 ");
        }