public async Task <IActionResult> AddOrUpdate([FromBody] SubTaskModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetFirstError())); } var SubTask = await _subTaskService.AddOrUpdate(Mapper.Map <SubTask>(model)); if (model.PublishNow) { await PublishSubTask(new PublishSubTaskModel { CompanyId = SubTask.CompanyId, TaskHeadId = SubTask.TaskHeadId, SubTaskId = SubTask.Id }); } model.Order = SubTask.Order; model.Id = SubTask.Id; return(Ok(model)); }