Exemple #1
0
        public IHttpActionResult Add([FromBody] TblDataBaseConnectionDto dataBaseConnectionDto)
        {
            var data = this.databaseConnectionService.GetSensitiveDataByEnvironmentAndCategoryId(dataBaseConnectionDto.EnvironmentId, dataBaseConnectionDto.CategoryId);

            if (!data.IsError)
            {
                data.Messages.Add(new Message(null, "DataBase Connection already exists with same environment and category combination"));

                return(this.CreateCustomResponse(data, HttpStatusCode.BadRequest));
            }

            return(this.AddUpdate(dataBaseConnectionDto));
        }
Exemple #2
0
        /// <summary>
        /// Adds the update.
        /// </summary>
        /// <param name="dataBaseConnectionDto">The database connection dto.</param>
        /// <returns>Newly added object</returns>
        private IHttpActionResult AddUpdate(TblDataBaseConnectionDto dataBaseConnectionDto)
        {
            var result = new ResultMessage <TblDataBaseConnectionDto>();

            try
            {
                result = this.databaseConnectionService.SaveOrUpdate(dataBaseConnectionDto, this.UserId);
            }
            catch (Exception ex)
            {
                this.LoggerService.LogException(ex);
                result.Messages.Add(new Message(null, ex.Message));
            }

            return(this.CreateCustomResponse(result));
        }
Exemple #3
0
        public IHttpActionResult GetAllDataBaseList(TblDataBaseConnectionDto dataBaseConnectionDto)
        {
            var result = new ResultMessage <List <string> >();

            try
            {
                result = this.databaseConnectionService.GetAllDataBaseList(dataBaseConnectionDto);
            }
            catch (Exception ex)
            {
                this.LoggerService.LogException(ex);
                result.Messages.Add(new Message(null, ex.Message));
            }

            return(this.CreateCustomResponse(result));
        }