Exemplo n.º 1
0
        internal ApiResult SaveAccessType(AccessType settting)
        {
            ApiResult apiResult = new ApiResult();

            try
            {
                if (!settting.IsValid())
                {
                    apiResult.SetFailuresAsStatusInResponseFields(settting.StatusDesc);
                    return(apiResult);
                }

                SystemType old = SystemType.QueryWithStoredProc("GetAccessTypeByID", settting.AccessTypeCode).FirstOrDefault();

                settting.Id = old != null ? old.Id : settting.Id;

                settting.Save();
                apiResult.SetSuccessAsStatusInResponseFields();
            }
            catch (Exception ex)
            {
                HandleError(nameof(AttachSystemAffectedToChangeRequest), "EXCEPTION", ex.Message);
                apiResult.SetFailuresAsStatusInResponseFields(ex.Message);
            }
            return(apiResult);
        }