In edit http post i need to remove courses stored in ids variable
- $("#tb").on("click", ".r", function () {
- $(this).parent().parent().hide();
- $(this).parent().prev().prev().find("input").addClass("remove");
- var ids = [];
- var i = 0;
- $(".remove").each(function () {
- ids[i] = $(this).val();
- i++;
- });
- for (var k = 0; k < ids.length; k++) {
- alert(ids[k]);
- }
- });
- var index = 0;
- $.ajax({
- url: "/Employeedata/getcoursesbyempid",
- data:{x:$("#hid").val()},
- success: function (res) {
- $.each(res, function (i, e) {
- $("#tb").append("
")+ index + "].CourseId' value='" + e.Id + "'/> " + e.CourseName + " - index++;
- });
- }
- })
- public JsonResult getcoursesbyempid(int x)
- {
- db.Configuration.ProxyCreationEnabled = false;
- var data = db.EmployeeCourses.Where(a => a.EmployeeId == x).Join(db.Courses, a => a.CourseId, b => b.Id, (a, b) => new { Id = a.CourseId, CourseName = b.CourseName });
- return Json(data, JsonRequestBehavior.AllowGet);
- }
- public class Cusomemp2
- {
- public int Id { get; set; }
- public string Name { get; set; }
- public List
empcourses { get; set; } - }
- [HttpPost]
- public ActionResult Edit(Cusomemp2 custom)
- {
- //what i write to remove courses saved in ids from table EmployeeCourse
- return View();
- }


Manas MohapatraRank #182 · 13.2K reputationPosted Oct 8, 2016, 8:00 AM EDT
ahmed salahRank #2,612 · 534 reputationPosted Oct 8, 2016, 11:48 AM EDT