Added ability to delete channels.
This commit is contained in:
parent
d5521074fe
commit
57b057516c
@ -69,21 +69,11 @@ namespace YTManager.Controllers {
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// PUT api/values/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody]JObject value)
|
||||
{
|
||||
Models.Channel posted = value.ToObject<Models.Channel>();
|
||||
posted.ChannelId = id; // Ensure an id is attached
|
||||
_context.Channels.Update(posted);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
// DELETE api/values/5
|
||||
// DELETE api/Channels/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
public void Delete(string id)
|
||||
{
|
||||
_context.Remove(_context.Channels.Single(m => m.ChannelId == id));
|
||||
_context.Remove(_context.Channels.Single(m => m.YTChannelID == id));
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ var tbody0 = new Vue({
|
||||
<th>Title</th>
|
||||
<th>Description</th>
|
||||
<th>ID</th>
|
||||
<th>Update</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -136,7 +136,10 @@ var tbody0 = new Vue({
|
||||
<td class="tinytext12px">{{entry.title}}</td>
|
||||
<td class="tinytext12px">{{entry.description}}</td>
|
||||
<td class="tinytext12px">{{entry.channelId}}</td>
|
||||
<td><i class="fa fa-refresh" aria-hidden="true" :id="entry.ytChannelID" @click="forcerefresh"/></td>
|
||||
<td>
|
||||
<a href="#"><i class="fa fa-refresh" aria-hidden="true" :id="entry.ytChannelID" @click="forcerefresh"/></a>
|
||||
<a href="#"><i class="fa fa-trash-o" aria-hidden="true" :id="entry.ytChannelID" @click="deletechannel"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -161,10 +164,14 @@ var tbody0 = new Vue({
|
||||
});
|
||||
},
|
||||
forcerefresh: function (event) {
|
||||
console.log("Refreshing for ID: " + event.target.id);
|
||||
axios
|
||||
.post('/api/Admin/job_update/' + event.target.id)
|
||||
.catch(function (error) { console.log(error); });
|
||||
},
|
||||
deletechannel: function (event) {
|
||||
axios
|
||||
.delete('/api/Channels/' + event.target.id)
|
||||
.catch(function (error) { console.log(error); });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user