public ActionResult Create(SalesModel model) { GetDefaultData(); ViewBag.Islook = "new"; if (!ModelState.IsValid) { return(View(model)); } try { model.CreateBy = CurrenUser.Id; model.VoucherId = stockReceivingService.GetVoucherId(); model.DateCreate = DateTime.Now; long voucherId = model.VoucherId; salesServices.InsertSale(model, out voucherId); return(RedirectToAction("Edit", new { id = voucherId })); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); return(View(model)); } }