private void UpdateEntityObject(BookGiving entityObject,
                                 BookTableModel model)
 {
     entityObject.ClassName   = model.ClassName;
     entityObject.BookName    = model.BookName;
     entityObject.Author      = model.Author;
     entityObject.DateGiving  = model.DateGiving;
     entityObject.Note        = model.Note;
     entityObject.Description = model.Description;
 }
Exemple #2
0
        public BooksTableGrid()
        {
            InitializeComponent();
            _bookTableModel = ((App)Application.Current).Model.BookTable;
            ShowOrRefreshBookGrid();

            _selectedBook            = null;
            Btn_DeleteBook.IsEnabled = false;
            Btn_EditBook.IsEnabled   = false;
        }
 public ActionResult Create(BookTableModel model)
 {
     if (!ModelState.IsValid)
     {
         ViewBag.BookName = CreateBookNamesSelectList();
         return(View(model));
     }
     Objects.Add((BookGiving)model);
     StaticDataContext.Save();
     TempData["message"] = string.Format(
         "Дані \"{0}\" збережено", model.BookName);
     return(RedirectToAction("Index"));
 }
        public ActionResult Edit(BookTableModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.BookName = CreateBookNamesSelectList();
                return(View(model));
            }
            var entityObject = Objects.First(e => e.Id == model.Id);

            UpdateEntityObject(entityObject, model);
            StaticDataContext.Save();
            TempData["message"] = string.Format(
                "Зміни даних \"{0}\" збережено", model.BookName);
            return(RedirectToAction("Index"));
        }
Exemple #5
0
 public void InitilizeTablesWithDependencies()
 {
     _seriesTable   = new SeriesTableModel();
     _bookInfoTable = new BookInfoTableModel();
     _books         = new BookTableModel();
 }