Exemplo n.º 1
0
        public JsonResult save_hierarchy(string TableData)
        {
            successFailureModel sm = new successFailureModel();

            try
            {
                var serializeData = JsonConvert.DeserializeObject <List <HierarchyModel> >(TableData);

                ListtoDataTableConverter converter = new ListtoDataTableConverter();

                DataTable dt = converter.ToDataTable(serializeData);

                string   res      = dblayer.save_hierarchy(dt);
                string[] response = res.Split(',');
                if (response[0] == "Success")
                {
                    sm.SuccessMsg = response[1];
                }
                else
                {
                    sm.ErrorMsg = response[1];
                }
            }
            catch (Exception ex)
            {
                sm.ErrorMsg = ex.Message;
            }
            return(Json(sm, JsonRequestBehavior.AllowGet));
        }