public IActionResult Create(ChannelCreateModel request) { var url = "https://news-fpt-api.azurewebsites.net/api/Channels"; var json = JsonConvert.SerializeObject(request); var result = api.SendAsyncJson(url, json, false); Debug.WriteLine(result); return(RedirectToAction("Index", "Channel")); }
public HttpResponseMessage CreateChannel(ChannelCreateModel channelModel) { var responseMsg = this.PerformOperation(() => { ChannelsRepository.CreateChannel(channelModel.Name, channelModel.Nickname, channelModel.Password); }); return(responseMsg); }
public IActionResult CreateChannel(ChannelCreateModel channelCreate) { if (channelCreate == null) { return(BadRequest("null")); } bool check = _channelLogic.CreateNewChannel(channelCreate); if (!check) { return(BadRequest("Cannot create a new channel")); } return(Ok("Success")); }
public bool CreateNewChannel(ChannelCreateModel channelCreateModel) { bool check = false; if (channelCreateModel != null) { Channel channel = new Channel() { ChannelId = channelCreateModel.ChannelId, ChannelName = channelCreateModel.ChannelName, IsActive = channelCreateModel.IsActive, }; _unitOfWork.GetRepository <Channel>().Insert(channel); _unitOfWork.Commit(); check = true; } return(check); }