Ejemplo n.º 1
0
        public virtual object DeleteRecordData(LocalizedGroupDataItemRecordInput 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.GroupKey      = _forcedGroupKey ?? o.GroupKey;
            o.AuditChangeBy = User.Identity.Name;
            try
            {
                //bResult =
                var oResult = _repo.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)));
        }
Ejemplo n.º 2
0
        public virtual object GetRecordData(LocalizedGroupDataItemRecordInput o)
        {
            ILocalizedGroupDataItem oResult;

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

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


            return(JToken.FromObject(oResult));
        }
Ejemplo n.º 3
0
 public override object SaveRecordData(LocalizedGroupDataItemRecordInput o)
 {
     o.Language = string.IsNullOrWhiteSpace(o.Language) ? "EN" : o.Language;
     return(base.SaveRecordData(o));
 }