Esempio n. 1
0
        public BsJsonResult EnableDisable(List <BsGridRowData <int> > items, bool?enable, int?stateId)
        {
            var msg      = string.Empty;
            var status   = BsResponseStatus.Success;
            var rowsHtml = string.Empty;

            try
            {
                foreach (var item in items)
                {
                    //simulate exception
                    if (item.Id == 2)
                    {
                        throw new Exception("This is how an exception message is displayed when it's triggered on row control");
                    }

                    _gridRepository.EnableDisable(item.Id, enable);
                }

                rowsHtml = GetRowsHtml(items, stateId);
            }
            catch (Exception ex)
            {
                msg    = "<strong>" + Resource.ServerError + "!</strong> " + ex.Message;
                status = BsResponseStatus.ServerError;
            }

            return(new BsJsonResult(new
            {
                RowsHtml = rowsHtml
            }, status, msg));
        }