Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
how to call insert update method in console or client applic
Anjali Khan
Nov 10 2016 11:22 AM
265
Reply
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
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
convert image to grayscale .net mvc
How to display the image to picturebox from sql server2008