public void AddAnswerForOption(Guid simplePollId, Guid optionId, string employeeName)
        {
            SimplePollOption option = _storageFunctionality.Get <SimplePollOption>(optionId);
            SimplePollAnswer answer = new SimplePollAnswer()
            {
                Id                 = ObjectModel.GenerateGuid(),
                EmployeeName       = employeeName,
                SimplePollOptionId = optionId
            };

            _storageFunctionality.Add(simplePollId, answer);
        }
Пример #2
0
        public ActionResult AddOption([FromBody] SimplePollOptionUpdateModel model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            SimplePollOption option = new SimplePollOption()
            {
                Id   = ObjectModel.GenerateGuid(),
                Text = model.Text
            };

            _logic.AddOptionToSimplePoll(model.SimplePollId, option);

            return(Ok());
        }
        public ActionResult AddSimplePoll([FromBody] SimplePollUpdateModel model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            SimplePoll simplePoll = new SimplePoll()
            {
                Id   = ObjectModel.GenerateGuid(),
                Text = model.Text,
                Type = model.Type
            };

            _logic.AddSimplePoll(simplePoll);

            string jsonResult = JsonConvert.SerializeObject(simplePoll);

            return(Content(jsonResult, "application/json"));
        }