Added ability to delete channels.

This commit is contained in:
2017-09-03 04:02:28 -04:00
parent d5521074fe
commit 57b057516c
2 changed files with 13 additions and 16 deletions

View File

@ -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();
}
}