示例#1
0
        public async Task <ObjectResponse> CreateWidgetAsync(CreateWidgetDto input)
        {
            ObjectResponse reponse = new ObjectResponse();

            try
            {
                await _widgetManager.CreateWidget(
                    input.Name,
                    input.Owner,
                    input.Logo,
                    input.WelcomeMessage,
                    input.PrimaryColor,
                    input.TeamIntro,
                    input.BackgroundColor,
                    input.ObjectConfigs
                    );

                reponse.message = "Ok";
                return(reponse);
            }
            catch (Exception ex)
            {
                var er = ex.Message;
                reponse.error.Add(er);
                return(reponse);
            }
        }
示例#2
0
        public async Task <IHttpActionResult> CreateAsync(CreateWidgetDto createWidgetDto)
        {
            var newWidget = TileWidget.Build(CurrentUser.Id, createWidgetDto.Name, createWidgetDto.Name, createWidgetDto.Url);

            _repository.Add(newWidget);

            await _unitOfWork.CompleteAsync();

            return(Created(new Uri(Request.RequestUri + "/" + newWidget.Id), newWidget));
        }
示例#3
0
        public async Task <ActionResult <object> > CreateWidget([FromBody] CreateWidgetDto input)
        {
            ObjectResponse response = new ObjectResponse();

            response = await _widgetService.CreateWidgetAsync(input);

            response.data = null;

            if (response.error.Count < 1 || response.error == null)
            {
                return(Ok(response));
            }
            else
            {
                return(BadRequest());
            }
        }