public ActionResult Create(ExpenseCreateVM model) { try { if (ModelState.IsValid) { string FileName = ""; if (model.file != null) { FileName = model.file.FileName; string url_path = Path.Combine(Server.MapPath("~/path"), Path.GetFileName(FileName)); model.file.SaveAs(url_path); } expense exp = new expense() { name = model.name, description = model.description, expense_id = model.expense_id, date_expense = model.date_expense, register_date = DateTime.Now, create_user_id = int.Parse(Session["UserID"].ToString()), update_user_id = int.Parse(Session["UserID"].ToString()), amount_money = 0, name_file = FileName, activo = 1, selling_point = model.selling_point, tipo_comprobante_id = model.tipo_comprobante_id, nro_comprobante = model.nro_comprobante, cuit_cuil = model.cuit_cuil, nro_cuit_cuil = model.nro_cuit_cuil, denominacion_emisor = model.denominacion_emisor, imp_neto_gravado = model.imp_neto_gravado, imp_neto_no_gravado = model.imp_neto_no_gravado, imp_op_exentas = model.imp_op_exentas, iva = model.iva, importe_total = model.importe_total, proveedor_id = model.proveedor_id, periodo = model.periodo, pay_state = model.pay_state, pay_date = model.pay_date }; _repo.ExpenseAdd(exp); return(RedirectToAction("Index")); } } catch (Exception ex) { ModelState.AddModelError("", "Se produjo un error, en caso de persistir, ponerse en contacto con el Administrador."); } ViewBagCreate(model.expense_id); ViewBagCreateTipoComprobante(model.tipo_comprobante_id); GetComboCC(); GetComboProv(); GetComboPeriodo(); return(View(model)); }