Esempio n. 1
0
        public ActionResult Create()
        {
            ONhaXuatBan data = new ONhaXuatBan();

            data.TrangThai = false;

            return(View("Update", data));
        }
Esempio n. 2
0
        public ONhaXuatBan Get(int id)
        {
            conn.connect();
            var comm = new SqlCommand("NXB_Get", conn.db);

            comm.CommandType = CommandType.StoredProcedure;
            comm.Parameters.Add("@MaNXB", SqlDbType.Int).Value = id;

            DataTable   dt  = new DataTable();
            ONhaXuatBan nxb = new ONhaXuatBan();

            dt.Load(comm.ExecuteReader());
            nxb = Help.DAL.ConvertDataTable <ONhaXuatBan>(dt).FirstOrDefault();

            return(nxb);
        }
Esempio n. 3
0
        public void Add(ONhaXuatBan item)
        {
            conn.connect();
            var comm = new SqlCommand("NXB_Add", conn.db);

            comm.CommandType = CommandType.StoredProcedure;

            comm.Parameters.Add("@TenNXB", SqlDbType.NVarChar).Value = item.TenNXB;
            comm.Parameters.Add(new SqlParameter("@DiaChi", item.DiaChi ?? (object)DBNull.Value));
            comm.Parameters.Add(new SqlParameter("@SDT", item.SDT ?? (object)DBNull.Value));
            comm.Parameters.Add(new SqlParameter("@Email", item.Email ?? (object)DBNull.Value));
            comm.Parameters.Add(new SqlParameter("@GhiChu", item.GhiChu ?? (object)DBNull.Value));
            comm.Parameters.Add(new SqlParameter("@TrangThai", item.TrangThai ?? (object)DBNull.Value));
            comm.ExecuteNonQuery();
            conn.Close();
        }
Esempio n. 4
0
        public ActionResult Create(ONhaXuatBan model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    nxbService.Add(model);
                    return(RedirectToAction("Search", "QuanLyNXB"));
                }
                catch (Exception e)
                {
                }
            }

            ViewBag.IsEdit = true;
            return(View("Update", model));
        }
Esempio n. 5
0
        public ActionResult Update(ONhaXuatBan model)
        {
            if (ModelState.IsValid)
            {
                var pro = nxbService.Get(model.MaNXB);
                if (pro != null)
                {
                    try
                    {
                        nxbService.Update(model);
                        return(RedirectToAction("Search", "QuanLyNXB"));
                    }
                    catch (Exception e)
                    {
                    }
                }
            }

            ViewBag.IsEdit = true;
            return(View(model));
        }