I have a mysql database with tables "end results", "tags" and "deliverables_has_tags". I want to associate tags with available ones.
This is what I do in my javascript file:
<script type="text/javascript" language="javascript"> $(function () { var object = {}; $.ajax({ type: "GET", url: "/Deliverable/Tags", dataType: "json", success: function (data) { object.tags = data; } }); function split(val) { return val.split(/,\s*/); } function extractLast(term) { return split(term).pop(); } $("#tags") </script>
I can add some tags to the text box.
But now I want to save this in my repository. In my Action method in the controller:
repository.AddDeliverable(model.Title, model.Description, model.UsernameID, data, datatwo, model.VideoUrl, model.AfstudeerrichtingID, model.ProjectID);
Tag Action:
public JsonResult Tags() { var data = (repository.GetTags()).ToArray(); return Json(data, JsonRequestBehavior.AllowGet); }
In my repository:
public IQueryable<string> GetTags() { return from tag in entities.tags orderby tag.tag_name select tag.tag_name; }
I have no clue how to save this in my database.
Can anybody help me?
source share