public ActionResult Create([Bind(Include = "REQ_IDE_REQUEST,REQ_IDE_USER,REQ_IDE_AREA,REQ_DES_TYPE_GASTO,REQ_DES_CONCEPT,REQ_DES_QUANTITY,REQ_DES_OBSERVATIONS,REQ_IDE_STATUS_APROV,REQ_FH_CREATED")] Request request) { if (ModelState.IsValid) { request.REQ_FH_CREATED = DateTime.Now; if (db.Create(request)) { return(RedirectToAction("Index")); } } return(View(request)); }
public ActionResult Create([Bind(Include = "REQ_IDE_REQUEST,REQ_IDE_USER,REQ_IDE_AREA,REQ_DES_TYPE_GASTO,REQ_DES_CONCEPT,REQ_DES_QUANTITY,REQ_DES_OBSERVATIONS,REQ_IDE_STATUS_APROV,REQ_FH_CREATED")] Request request) { if (ModelState.IsValid) { var user = (CustomSerializeModel)Session["user"]; if (user != null) { request.REQ_FH_CREATED = DateTime.Now; request.REQ_IDE_USER = user.UserId; request.REQ_IDE_STATUS_APROV = 0; if (db.Create(request)) { return(RedirectToAction("Index")); } } else { return(RedirectToAction("Logout", "Account")); } } return(View(request)); }