Beispiel #1
0
        public IActionResult Add([FromBody] AddTaskDto taskDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            _toDoTaskServices.Add(taskDto);
            return(Ok());
        }
        public override async Task <ActionResult <SuccessResponseApiModel <string> > > Add([FromBody] ToDoTaskAddApiModel model)
        {
            if (model.FromUserId == null)
            {
                model.FromUserId = GetUserId();
            }

            string id = await _service.Add(model);

            var modelResult = await _service.Get(id);

            await BroadcastMessageSignalR(NotificationTypeEnum.ModelAdd, modelResult, false, model.ToUserId);

            return(SuccessResult(new SuccessResponseApiModel <string>()
            {
                Response = "success", Id = id
            }));
        }