Is there a way to update a model item, while also adding a new item to one of it's properties at the same time?
Let's say I have the following Models:
public class Article
{
public string ArticleName { get; set; }
public string ArticleText { get; set; }
public virtual ICollection<ArticleNotes> ArticleNotes { get; set; }
}
public class ArticleNotes
{
public string ArticleNote { get; set; }
}
And the following view:
@model MyApp.Models.Article
@using (Html.BeginForm("Article", "Article", FormMethod.Post))
{
@Html.EditorFor(model => model.ArticleName)
@Html.EditorFor(model => model.ArticleText)
<button id="btnSave" name="Submit" type="submit" value="Save" >Save</button>
}
Is there a way in this same view to also save a new ArticleNote?
I know I could create a model that holds both a Article property and a separate ArticleNote property, but I wanted to see if I could do something else since I already have a collection of type ArticleNote in Article already. Thanks.