フィードバック フォームにチェックボックスがあり
ます。モデルにチェックボックスを追加したようです
namespace CorePartners_Site2.Models
{
public class CareerForm
{
//...
public List<CheckBoxes> EmploymentType { get; set; }
}
public class CheckBoxes
{
public string Text { get; set; }
public bool Checked { get; set; }
}
}
コントローラーに追加
[HttpGet]
public ActionResult CareerForm()
{
CareerForm model = new CareerForm();
model.EmploymentType = new List<CheckBoxes>
{
new CheckBoxes { Text = "Fulltime" },
new CheckBoxes { Text = "Partly" },
new CheckBoxes { Text = "Contract" }
};
return View(model);
}
しかし、選択したチェックボックスをメールに追加する必要がありますが、その方法がわかりません。
私は試した
public ActionResult CareerForm(CareerForm Model, HttpPostedFileBase Resume)
{
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.BodyEncoding = Encoding.UTF8;
string message = //...
"Type: " + Model.EmploymentType;
msg.Body = message;
//....
}
しかし、私はメールにType: System.Collections.Generic.List`1[CheckBoxes]
というテキストだけを受け取ります
。