public IActionResult addTopics() { int i = 0; var topics = new List <TopicModel> { new TopicModel { user_code = "Drep001", enabled_flg = 1, topic_name = "Depression", desc = "Despression is a mental disease" }, new TopicModel { user_code = "Bullying001", enabled_flg = 1, topic_name = "Bullying", desc = "Bullying is bad" } }; foreach (var item in topics) { _commconService.addTopic(item); i++; } var tmp = _commconService.saveTopc(); return(Ok(tmp)); }
public IActionResult addTopic(TopicModel obj) { try { _commRes.addTopic(obj); _commRes.saveTopc(); return(Ok()); } catch { return(BadRequest()); } }