hi Frnds
i created class where i created a all methods like insert update delete?
i am sending a code also.now i want to call these method for the insert update delete in .net so how to do that
/
how to call these method?
namespace LibraryProject
{
public enum catagory
{
ROMANTIC = 0,
HORROR = 1
}
public class LibraryHandler : ILibraryv1,ILibraryv2
{
List booksList = null;
public LibraryHandler()
{
booksList = new List();
}
public bool AddBook(Ebook book)
{
if (book != null)
{
booksList.Add(book);
return true;
}
return false;
}
public bool DeleteBok(int Id)
{
int index = booksList.FindIndex(i => i.BookId == Id);
if (index > 0)
{
booksList.RemoveAt(index);
return true;
}
return false;
}
public bool UpdateBook(Ebook book)
{
foreach (var item in booksList)
{
if (item.BookId == book.BookId)
{
item.BookName = book.BookName;
item.Category = book.Category;
return true;
}
}
return false;
}
public Ebook GetBook(int Id)
{
return booksList.Where(i => i.BookId == Id).FirstOrDefault();
}
public List GetBooks()
{
return booksList;
}
public bool AddBookWithCategory(Ebook book)
{
return true;
}
public List GetBookByCategory(string Category)
{
return booksList.Where(i => i.Category == Category.ToString()).ToList();
}
public List GetBookByRomanticAutor(string Authorname)
{
booksList.Where(i => i.GetAuthor() == Authorname);
return booksList;
}
public List AddBookByRomanticAutor(EDramaBook book)
{
booksList.Add(book);
return booksList;
}
}
}
i am using vs2012
{
public enum catagory
{
ROMANTIC = 0,
HORROR = 1
}
public class LibraryHandler : ILibraryv1,ILibraryv2
{
List
public LibraryHandler()
{
booksList = new List
}
public bool AddBook(Ebook book)
{
if (book != null)
{
booksList.Add(book);
return true;
}
return false;
}
public bool DeleteBok(int Id)
{
int index = booksList.FindIndex(i => i.BookId == Id);
if (index > 0)
{
booksList.RemoveAt(index);
return true;
}
return false;
}
public bool UpdateBook(Ebook book)
{
foreach (var item in booksList)
{
if (item.BookId == book.BookId)
{
item.BookName = book.BookName;
item.Category = book.Category;
return true;
}
}
return false;
}
public Ebook GetBook(int Id)
{
return booksList.Where(i => i.BookId == Id).FirstOrDefault();
}
public List
{
return booksList;
}
public bool AddBookWithCategory(Ebook book)
{
return true;
}
public List
{
return booksList.Where(i => i.Category == Category.ToString()).ToList();
}
public List
{
booksList.Where(i => i.GetAuthor() == Authorname);
return booksList;
}
public List
{
booksList.Add(book);
return booksList;
}
}
}
i am using vs2012
Anjali KhanPosted Nov 11, 2016, 8:17 AM
Anjali KhanPosted Nov 11, 2016, 8:13 AM
Manas MohapatraPosted Nov 10, 2016, 1:00 PM
libHandler.AddBook(obj);
libHandler.DeleteBok(1);
libHandler.UpdateBook(obj);