예제 #1
0
        public JsonResult SaveFB(string method, int MFBId, string Desc, string CID)
        {
            var rObject = new MethodResponse()
            {
                Result       = true,
                ErrorMessage = "",
                Content      = new Models.WorkroomsUserObject[] { }
            };

            Helpers.CtxService service = new Helpers.CtxService(null, CID);

            try
            {
                if (CID.Length < 6)
                {
                    throw new Exception("could not find location variable");
                }

                switch (method)
                {
                case "fb_add":
                    rObject.Result = service.AddFB(Desc);
                    if (!rObject.Result)
                    {
                        rObject.ErrorMessage = service.errorMessage;
                    }
                    break;

                case "fb_edit":

                    rObject.Result = service.EditFB(MFBId, Desc);
                    if (!rObject.Result)
                    {
                        rObject.ErrorMessage = service.errorMessage;
                    }
                    //else
                    //    service.EditCachedWorkroom(id, Name, Abbreviation);

                    break;
                }
            } catch (Exception ex)
            {
                rObject.Result       = false;
                rObject.ErrorMessage = ex.Message;
            }

            if (rObject.Result == true)
            {
                removeCacheHTML();
            }
            else
            {
                rObject.ErrorMessage = service.errorMessage;
            }

            return(Json(rObject));
        }