Пример #1
0
        internal ApiResult SaveSystemType(SystemType settting)
        {
            ApiResult apiResult = new ApiResult();

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

                SystemType old = SystemType.QueryWithStoredProc("GetSystemTypeByID", settting.TypeCode).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);
        }