public bool UpdateType(BookTypeModel bookType) { try { book_type bt = IQueryableType().FirstOrDefault(o => o.book_type_id == bookType.book_type_id); bt.book_type_name = bookType.book_type_name; db.SaveChanges(); return(true); } catch (Exception ex) { throw ex; } }
internal BookTypeModel Mapping(book_type m) { try { if (m != null) { BookTypeModel bt = new BookTypeModel(); bt.book_type_id = m.book_type_id; bt.book_type_name = m.book_type_name; return(bt); } return(null); } catch (Exception ex) { throw ex; } }
public bool AddBookType(BookTypeModel m) { try { if (IQueryableType().Where(o => o.book_type_name == m.book_type_name).ToList().Count == 0) { book_type _obj = Mapping(m); db.book_type.Add(_obj); db.SaveChanges(); return(true); } return(false); } catch (Exception ex) { throw ex; } }
public book_type Mapping(BookTypeModel t) { try { if (t != null) { book_type bt = new book_type(); bt.book_type_id = t.book_type_id; bt.book_type_name = t.book_type_name; return(bt); } return(null); } catch (Exception ex) { throw ex; } }
internal BookTypeModel Mapping(book_type b) { //ACTION = "Mapping(BookType)"; try { if (b != null) { return(new BookTypeModel() { book_type_id = b.book_type_id, book_type_name = b.book_type_name }); } return(null); } catch (Exception ex) { throw ex; } }
public bool AddBookType(BookTypeModel m) { if (m == null) { throw new Exception("no object"); } try { if (IQueryable().Where(b => b.book_type_name == m.book_type_name).ToList().Count == 0) { book_type _obj = Mapping(m); dbh.book_type.Add(_obj); dbh.SaveChanges(); return(true); } return(false); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <book_type> Mapping(List <BookTypeModel> list) { try { if (list != null && list.Count > 0) { List <book_type> btList = new List <book_type>(); foreach (BookTypeModel bt in list) { book_type b = new book_type(); b.book_type_id = bt.book_type_id; b.book_type_name = bt.book_type_name; btList.Add(b); } return(btList); } return(null); } catch (Exception ex) { throw ex; } }