Exemplo n.º 1
0
        public ActionResult Index(BookDetails searchDetails)
        {
            //--Получаем данные из <input> полей--
            string genre = Request["genre"];
            string size = Request["size"];
            string rating = Request["rating"];
            string state = Request["state"];
            string category = Request["category"];
            bool blah = Convert.ToBoolean(Request["blah"]);
            string searchName = Request["searchName"];

            return RedirectToAction("Index","Book", new System.Web.Routing.RouteValueDictionary(new { blah = blah,
                                                                                                      genre = genre,
                                                                                                      size = size,
                                                                                                      rating = rating,
                                                                                                      state = state,
                                                                                                      category = category,
                                                                                                      searchName = searchName }));
        }
Exemplo n.º 2
0
        public void Add(BookDetails item)
        {
            db.Open();

            command.Connection = db;
            SqlCeResultSet result;
            command.CommandType = CommandType.TableDirect;
            command.CommandText = table;
            result = command.ExecuteResultSet(ResultSetOptions.Scrollable | ResultSetOptions.Updatable);
            result.Read();

            SqlCeUpdatableRecord record = result.CreateRecord();
            record.SetInt32(0, item.BookID);
            record.SetString(1, item.title);
            record.SetString(2, item.author);
            record.SetString(3, item.size);
            record.SetString(4, item.rating);
            record.SetString(5, item.category);
            record.SetString(6, item.state);
            record.SetString(7, item.summary);
            record.SetString(8, item.genre);
            record.SetString(9, item.comment);
            result.Insert(record, DbInsertOptions.PositionOnInsertedRow);

            db.Close();
        }
Exemplo n.º 3
0
        public BookDetails Load(Int32 id)
        {
            sql = "SELECT * FROM " + table + " WHERE  " + table + "ID = " + id;

            db.Open();

            command.Connection = db;
            command.CommandText = sql;
            SqlCeDataReader result = command.ExecuteReader();

            BookDetails data = new BookDetails();
            while (result.Read())
            {
                data = new BookDetails(result.GetInt32(0), result.GetString(1), result.GetString(2), result.GetString(3),
                    result.GetString(4), result.GetString(5), result.GetString(6), result.GetString(7), result.GetString(8), result.GetString(9));
            }

            db.Close();

            return data;
        }