Example #1
0
        public JsonResult SaveDMThuTuc()
        {
            try
            {
                using (MotCuaService = new MotCuaServiceClient())
                {
                    var modelDM_ThuTuc = Request.Form["model"];
                    var dm_ThuTuc      = JsonConvert.DeserializeObject <DM_ThuTuc>(modelDM_ThuTuc);
                    if (Session["DMThuTucID"] != null && Session["DMThuTucID"].ToString() != "0")
                    {
                        dm_ThuTuc.ThuTucID = Session["DMThuTucID"].ToString().ToInt();
                    }

                    var modelDM_ChungTuKemTheo = Request.Form["chungtukemtheo"];
                    var lstdm_ChungTuKemTheo   = JsonConvert.DeserializeObject <List <DM_ChungTuKemTheo> >(modelDM_ChungTuKemTheo ?? "");

                    if (dm_ThuTuc.ThuTucID != 0)
                    {
                        foreach (var item in lstdm_ChungTuKemTheo)
                        {
                            item.ThuTucID = dm_ThuTuc.ThuTucID;
                        }
                    }

                    var dM_ThuTucSave = new DM_ThuTucSave();
                    dM_ThuTucSave.dm_ThuTuc            = dm_ThuTuc;
                    dM_ThuTucSave.lstDM_ChungTuKemTheo = lstdm_ChungTuKemTheo;

                    var response = MotCuaService.MotCua_DM_ThuTuc_Save(dM_ThuTucSave);
                    Session["DMThuTucID"] = null;
                    return(Json(response.StatusCode != HttpStatusCode.OK ? null : new { response.Content }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Logger.Error(e.Message);
                Console.WriteLine(e);
                throw;
            }
        }