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)); }
/// <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)); }
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)); }