public ActionResult Create([Bind(Include = "MaDanhMuc,TenDanhMuc")] DanhMuc danhMuc) { if (ModelState.IsValid) { db.DanhMucs.Add(danhMuc); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(danhMuc)); }
public ActionResult Create([Bind(Include = "MaChuDe,TenChuDe,MaDanhMuc")] ChuDe chuDe) { if (ModelState.IsValid) { db.ChuDes.Add(chuDe); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaDanhMuc = new SelectList(db.DanhMucs, "MaDanhMuc", "TenDanhMuc", chuDe.MaDanhMuc); return(View(chuDe)); }
public ActionResult Create([Bind(Include = "MaThongTinNhom,TenTaiKhoan,MaNhom")] ThongTinNhom thongTinNhom) { if (ModelState.IsValid) { db.ThongTinNhoms.Add(thongTinNhom); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaNhom = new SelectList(db.Nhoms, "MaNhom", "TenNhom", thongTinNhom.MaNhom); return(View(thongTinNhom)); }
public ActionResult Create([Bind(Include = "TenTaiKhoan,MatKhau,TenHienThi,HinhAnh,SoDienThoai,MaLoaiTaiKhoan")] TaiKhoan taiKhoan) { if (ModelState.IsValid) { TaiKhoan taikhoan = db.TaiKhoans.Add(taiKhoan); db.SaveChanges(); if (Request.Files.Count > 0 && Request.Files[0].FileName.Trim() != "") { string[] _arr = Request.Files[0].FileName.Split('.'); string type = _arr[_arr.Length - 1]; taikhoan.HinhAnh = taikhoan.TenTaiKhoan + "." + type; Request.Files[0].SaveAs(Server.MapPath("~/Public/Upload/Img_TaiKhoan/") + taikhoan.HinhAnh); } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaLoaiTaiKhoan = new SelectList(db.LoaiTaiKhoans, "MaLoaiTaiKhoan", "TenLoaiTaiKhoan", taiKhoan.MaLoaiTaiKhoan); return(View(taiKhoan)); }
public ActionResult Register(TaiKhoan taiKhoan) { try { taiKhoan.MaLoaiTaiKhoan = 2; //TODO HardCode is member db.TaiKhoans.Add(taiKhoan); db.SaveChanges(); ViewBag["Message"] = "Tài khoản đã tồn tại"; return(View()); } catch (Exception) { return(View("Success", taiKhoan)); } }