Added ability to delete channels.
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user