Anjali Khan

Anjali Khan

  • NA
  • 867
  • 213.4k

how to call insert update method in console or client applic

Nov 10 2016 11:22 AM
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<Ebook> booksList = null;
public LibraryHandler()
{
booksList = new List<Ebook>();
}
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<Ebook> GetBooks()
{
return booksList;
}

public bool AddBookWithCategory(Ebook book)
{
return true;
}

public List<Ebook> GetBookByCategory(string Category)
{
return booksList.Where(i => i.Category == Category.ToString()).ToList();
}
public List<Ebook> GetBookByRomanticAutor(string Authorname)
{
booksList.Where(i => i.GetAuthor() == Authorname);
return booksList;
}
public List<Ebook> AddBookByRomanticAutor(EDramaBook book)
{
booksList.Add(book);
return booksList;
}
}
}

i am using vs2012

Answers (3)