Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "HinhAnh, CapBac")] tb_DoiNguQuanLy tb_doinguql)
        {
            if (ModelState.IsValid)
            {
                db.tb_DoiNguQuanLy.Add(tb_doinguql);
                db.SaveChanges();
            }
            tb_DoiNguQL_Trans qlVn = new tb_DoiNguQL_Trans();

            qlVn.NgonNgu    = "vi";
            qlVn.MaQL       = tb_doinguql.MaQL;
            qlVn.TenNguoiQL = string.IsNullOrEmpty(Request.Form["HoTenVn"]) ? Request.Form["HoTenEn"] : Request.Form["HoTenVn"];
            qlVn.ChucVu     = string.IsNullOrEmpty(Request.Form["ChucVuVn"]) ? Request.Form["ChucVuEn"] : Request.Form["ChucVuVn"];
            qlVn.CauNoi     = string.IsNullOrEmpty(Request.Form["CauNoiVn"]) ? Request.Form["CauNoiEn"] : Request.Form["CauNoiVn"];
            qlVn.MoTa       = string.IsNullOrEmpty(Request.Form["MoTaVn"]) ? Request.Form["MoTaEn"] : Request.Form["MoTaVn"];


            tb_DoiNguQL_Trans qlEn = new tb_DoiNguQL_Trans();

            qlEn.NgonNgu    = "en";
            qlEn.MaQL       = tb_doinguql.MaQL;
            qlEn.TenNguoiQL = string.IsNullOrEmpty(Request.Form["HoTenEn"]) ? Request.Form["HoTenEn"] : Request.Form["HoTenEn"];
            qlEn.ChucVu     = string.IsNullOrEmpty(Request.Form["ChucVuEn"]) ? Request.Form["ChucVuEn"] : Request.Form["ChucVuEn"];
            qlEn.CauNoi     = string.IsNullOrEmpty(Request.Form["CauNoiEn"]) ? Request.Form["CauNoiEn"] : Request.Form["CauNoiEn"];
            qlEn.MoTa       = string.IsNullOrEmpty(Request.Form["MoTaEn"]) ? Request.Form["MoTaEn"] : Request.Form["MoTaEn"];

            db.tb_DoiNguQL_Trans.Add(qlVn);
            db.tb_DoiNguQL_Trans.Add(qlEn);
            db.SaveChanges();


            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        // GET: /Admin/DoiNguQuanLy/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tb_DoiNguQuanLy tb_doinguql_trans = db.tb_DoiNguQuanLy.Find(id);

            if (tb_doinguql_trans == null)
            {
                return(HttpNotFound());
            }

            return(View(tb_doinguql_trans));
        }