コード例 #1
0
        public virtual object Delete(LocalizedContentFieldRecordInput o)
        {
            var bResult = false;

            o.GroupFilter = _groupFilter;

            if (!_unlockApi)
            {
                return(JToken.FromObject(new ApiStatusMessage("You do not have permissions to perform that action", "Permissions Denied", ApiMessageType.Alert)));
            }

            try
            {
                o.AuditChangeBy = User.Identity.Name;
                //bResult =
                var oResult = _repo.DeleteRecord(o);
                bResult = oResult != null;
                //_LocalizedContentFieldList.Refresh();
            }
            catch (Exception ex)
            {
                return(JToken.FromObject(new ApiExceptionMessage("An error has occurred", ex)));
            }

            if (bResult != true)
            {
                return(JToken.FromObject(new ApiStatusMessage("Record has been successfully deleted.", "Record Deleted", ApiMessageType.Success)));
            }

            // Else
            return(JToken.FromObject(new ApiStatusMessage("Unable to delete record. Please check the data and try again.", "Error while deleting", ApiMessageType.Danger)));
        }
コード例 #2
0
        public virtual object Data(LocalizedContentFieldRecordInput o)
        {
            ILocalizedContentField oResult;

            o.GroupFilter = _groupFilter;

            if (!_unlockApi)
            {
                return(JToken.FromObject(new ApiStatusMessage("You do not have permissions to perform that action", "Permissions Denied", ApiMessageType.Alert)));
            }

            try
            {
                oResult = _repo.GetRecord(o);
            }
            catch (Exception ex)
            {
                return(JToken.FromObject(new ApiExceptionMessage("An error has occurred", ex)));
            }

            if (oResult == null || oResult.Id < 1)
            {
                return(JToken.FromObject(new ApiStatusMessage("Unable to locate a matching record.", "Record not found", ApiMessageType.Danger)));
            }

            return(JToken.FromObject(oResult));
        }