public ActionResult EditPost(int?id, CotizacionViewModel mod) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } try { if (ModelState.IsValid) { var cliente = mod.Cotizacion.Clientes.ClienteId; var fecha = mod.GetDate(); Cotizacion file = DB.Cotizacion.Find(id); file.ClienteId = cliente; file.Fecha = fecha; DB.SaveChanges(); return(RedirectToAction("ProductoFac", new { cotId = file.CotizacionId })); } } catch (RetryLimitExceededException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator."); } return(View(mod)); }
public ActionResult CreateCot(CotizacionViewModel cot) { try { if (ModelState.IsValid) { var usuario = User.Identity.GetUserName(); var cliente = cot.Cotizacion.Clientes.ClienteId; var fecha = cot.GetDate(); Cotizacion file = new Cotizacion(); file.ClienteId = cliente; file.Fecha = fecha; DB.Cotizacion.Add(file); DB.SaveChanges(); TempData["Status"] = "Upload successful"; return(RedirectToAction("ProductoFac", new { cotId = file.CotizacionId })); } } catch (RetryLimitExceededException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(cot)); }