public ActionResult CreateDecision(DecisionModels model) { IDecisionService decSrc = IoC.Resolve <IDecisionService>(); try { IList <Pupor> lstp = (IList <Pupor>)model.DecDatasource.DeserializeJSON <Pupor>(typeof(IList <Pupor>)); Decision oDec = model.UpdateDecision(new Decision()); //oDec.EffectiveDate = DateTime.ParseExact(Request["EffectiveDate"], "dd/MM/yyyy", null); //lấy thông tin về mẫu hóa đơn đăng ký string json = "<Root>"; string lstPattern = ""; foreach (Pupor p in lstp) { json += "<Purpose>" + p.Mucdich + "</Purpose>"; lstPattern += p.InvPattern + ','; } json += "</Root>"; lstPattern = lstPattern.Remove(lstPattern.Length - 1, 1); oDec.ListInvPattern = lstPattern; oDec.Purpose = json; decSrc.CreateNew(oDec); decSrc.CommitChanges(); Messages.AddFlashMessage(Resources.Message.Dec_IMesSuccess); log.Info("Create Decision by: " + HttpContext.User.Identity.Name); return(RedirectToAction("ListDecision")); } catch (HttpRequestValidationException ex) { return(Redirect("/Home/PotentiallyError")); } catch (ArgumentException ex) { return(Redirect("/Home/PotentiallyError")); } catch (Exception ex) { ICompanyService _comSrv = IoC.Resolve <ICompanyService>(); Company _currentcompany = _comSrv.Getbykey(((EInvoiceContext)FXContext.Current).CurrentCompany.id); IRegisterTempService regisSrc = IoC.Resolve <IRegisterTempService>(); model.RegTempList = new SelectList(from re in regisSrc.Query where re.ComId == _currentcompany.id select re, "InvPattern", "InvPattern"); Messages.AddErrorMessage(Resources.Message.Dec_IMesUnsuccess); log.Error("CreateDecision -" + ex); return(View(model)); } }