예제 #1
0
        public LibraryLog Update(LibraryLog t)
        {
            LibraryLog f = Get(t.Id);

            if (f == null)
            {
                throw new ArgumentNullException($"Log Details with id {t.Id} does not exist or its deleted");
            }

            libraryLogs.Remove(t);


            if (t.Id <= 0)
            {
                throw new ArgumentException("Invalid Log Details Item Id");
            }

            f.BookNo         = t.BookNo;
            f.BookName       = t.BookName;
            f.MemberName     = t.MemberName;
            f.MobileNo       = t.MobileNo;
            f.Address        = t.Address;
            f.CheckedOutDate = t.CheckedOutDate;
            f.ReturnedDate   = t.ReturnedDate;



            f = DbStore.Save <LibraryLog>(f);

            return(f);
        }
예제 #2
0
        public void Delete(long id)
        {
            LibraryLog r = Get(id);

            DbStore.Delete <LibraryLog>(r);
            libraryLogs.Remove(r);
        }
예제 #3
0
        public LibraryLog Add(LibraryLog t)
        {
            if (!IsDuplicate(t))
            {
                t.Id = 0;
                var ret = DbStore.Save <LibraryLog>(t);

                if (ret != null)
                {
                    libraryLogs.Add(ret);
                }

                return(ret);
            }
            else
            {
                throw new DuplicateItemException("Log details already exists");
            }
        }
예제 #4
0
 bool IsDuplicate(LibraryLog r)
 {
     return(libraryLogs.Exists(d => (d.BookNo == r.BookNo && d.Id == r.Id && d.CheckedOutDate == r.CheckedOutDate)));
 }