I'm hoping you just forgot to post your delete action in your controller. But in the likelihood that you didn't, the reason why your item isn't deleting is because you have no delete code.
Since i know nothing about your html/javascript I'm going to assume you know how to make ajax calls. To throw this code in your edit action is a bad idea and would be confusing, that is unless you are trying to "Stage" the delete prior to pressing your submit button. But again, I have no idea what you are trying to do so i'll give two options.
1) Add another action to your controller for deletes.
[HttpPost]
public JsonResult Delete(int courseId)
{
var course = context.Courses.FirstOrDefault(m=>m.Id == courseId);
context.Courses.Remove(course);
context.SaveChanges();
return Json(new { }, JsonRequestBehavior.AllowGet);
}
2) If you are trying to stage the delete once submit has happened then you can do 2 things. Can can continuously delete and re-add everything. Or you can keep a hidden area in your HTML that keeps a running total of your course id's to delete/remove. This can be placed into your Edit action of your controller
So the first thing you'd do is have something like this, hidden in your html
<div id="things-to-hide">
</div>
Then on click of the remove, you would add a hidden input to the things-to-hide div that keeps a running tally of ID's to remove.
Something like
$(".remove").click(function() {
var idToRemove = $(this).data("id");
$("#things-to-hide").append("<input type="hidden" value=""+idToRemove+"" name="removeid" />");
});
Then in your model you need to add another property of an array of int's so your form submit, whether its Html.BeginForm or Ajax.BeginForm, can auto map your array of removeid to a property on your model.
So something like
public class EmployeeModel
{
public int[] removeid {get;set;}
}
Then in your controller, you can do something similar to what i posted in option 1 which is loop over the removeid array, which should contain the id's that are deisred to be remove, and leave the courses alone that you want to keep.
So it would look something like
[HttpPost]
public ActionResult Edit(EmployeeModel model)
{
foreach(var id in model.removeid)
{
var course = context.Courses.FirstOrDefault(m=>m.Id == courseId);
context.Courses.Remove(course);
context.SaveChanges();
}
}
Hopefully this points you in the right direction. This may not be a one size fits all so i encourage you to look at what i've submitted and massage it to fit your needs. But in general, this should fit what you are looking for.