ASP.Net MVC - read a class model in controller action method

Feb 2 2022 7:01 PM

public class DeleteRelatedModel
    {
        public int ID { get; set; }
        public string Code { get; set; }
        public bool IsDeleted { get; set; }
        public List<ArtifactModel> RelatedArtifact { get; set; }
        public LoginUserDetail LogInUser { get; set; }
    }

    public class LoginUserDetail
    {
        public string UserName { get; set; }
        public string UserEmail { get; set; }
    }

    public class ArtifactModel
    {
        public int ID { get; set; }
        public string OriginalFileName { get; set; }
        public DateTime? CreatedAt { get; set; }
    }
    
    //In contoller action method
    DeleteRelatedModel deleteRelated = GetDeleteDetails(id);
    
    How i can read the values from deleteRelated and bind it to separate variables. like
    
    List<ArtifactModel> artifact = new List<ArtifactModel>;
    LoginUserDetail loginUserDetail = new LoginUserDetail;
    


Answers (5)