예제 #1
0
        public bool Update([FromBody] Librarycard librarycard)
        {
            db.Librarycard.Update(librarycard);
            bool isSaved = db.SaveChanges(true) != 0;

            return(isSaved);
        }
예제 #2
0
        public bool Post([FromBody] Librarycard librarycard)
        {
            db.Librarycard.Add(librarycard);
            bool isSaved = db.SaveChanges(true) != 0;

            return(isSaved);
        }
예제 #3
0
        public bool Delete(int?id)
        {
            bool isDeleted = false;

            if (id != null)
            {
                Librarycard librarycard = db.Librarycard.FirstOrDefault(a => a.Id == id);
                if (librarycard != null)
                {
                    db.Librarycard.Remove(librarycard);
                    isDeleted = db.SaveChanges(true) != 0;
                }
            }

            return(isDeleted);
        }