'Automatically adding data from other model
I have models Workplace.cs and Request.cs
public class Workplace
{
public int Id { get; set; }
public string Name { get; set; } = "";
public string Cartridge { get; set; } = "";
}
public class Request
{
public int Id { get; set; }
public string Workplace { get; set; } = ""; (person can choose Name from Workplace here, I did it)
public string Cartridge { get; set; } = ""; (the same value is required like Cartridge in Workplace)
public string Comment{ get; set; } = "";
}
I did in request form with help of ViewBag that user can choose number of workplace (Name). How can I realise automatical addition of value "Cartridge" from workplace?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
