public override async Task <BaseReply> CreateDatabase(CreateDbRequest request, ServerCallContext context) { try { var db = new Dto.DataBase { Name = request.Name, Settings = new Dto.DbSettings { FileSize = request.FileSize, DefaultSource = (SupportedSources)request.SourceType } }; await _databaseService.CreateDb(db); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("***************************************************************************************************************"); Console.WriteLine("Database created: " + request.Name); Console.WriteLine("***************************************************************************************************************"); return(new BaseReply() { Code = 200, Message = "", StackTrace = "" }); } catch (Exception ex) { return(new BaseReply() { Code = 400, Message = ex.Message, StackTrace = ex.StackTrace }); } }
public async Task <ActionResult <RequestResult> > CreateDb([FromBody] DataBase db) { RequestResult result = await _dataBase.CreateDb(db); if (result.IsSuccess) { return(Ok(result)); } else { return(BadRequest(result)); } }