我这个是通过在页面上使用iframe加载进来的,没有错误提示,就是存不进去。可以的话顺便告知一下如何存图片。
[Authorize]
[ValidateInput(false)]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(news n)
{
n.nid = SqlHelper.get_ID("news", "nid");
n.uid = 1;
n.pic = "";
n.ndate = DateTime.Now;
db.news.InsertOnSubmit(n);
db.SubmitChanges();
var d2 = droplist();
ViewData["cid"] = new SelectList(d2, "cid", "name");
return RedirectToAction("Index");
}
这个是controller里面实现插入的代码
class UserController extends Controller{
public function index(){
//实例化用户模型
$user = D("User");
//AR操作数据
$user->u_username="李四";
$user->u_password="1234";
$user->u_nickname="四四";
$user->u_sex ="男";
$user->u_email = "sisi@.bb.com";
$user->u_birthday = "1997-3-3";
$user->u_tel = "1234000";
$user->u_addtime = time();
$user->u_address = "德国";
$user->add();