예제 #1
0
        public virtual object Delete(LocalizedContentText.Controllers.ApiController.LocalizedContentTextRecordInput o)
        {
            var bResult = false;

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

            o.GroupFilter   = _groupFilter;
            o.AuditChangeBy = User.Identity.Name;
            try
            {
                //bResult =
                var oResult = _languageRepository.DeleteRecord(o);
                bResult = oResult != null;
            }
            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(LocalizedContentText.Controllers.ApiController.LocalizedContentTextRecordInput o)
        {
            ILocalizedContentText oResult;

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

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


            return(JToken.FromObject(oResult));
        }