You doubt about the passage of data from a list to an entire variable

1

Good to all I comment the idea here is that to an Id of a File can be assigned to several users

eg IdExpediente: 51 can be assigned to IdMail: 17 y 58 and that is saved in table T_MAIL_EXP as I can do to be loaded in the table the way it shows

Id Expediente   Id_Mail
51              17
51              58

This would be the code:

[HttpPost]
    public ActionResult Asignar(FormCollection coleccion)
    {
        string _exp_id = Request["exp"];
        string _username = "";
        //int _id_Expediente;
        if (this.User.Identity.IsAuthenticated)
        _username = this.User.Identity.Name;
        try
        {
            T_EXP_ENVIO dbExpEnvio = new T_EXP_ENVIO()
            {
                N__Expediente = _exp_id
            };
            _seguimientoExpServicio.AgregarExpediente(dbExpEnvio);
            var IdExpEnvio = _seguimientoExpServicio.ObtenerIdExpEnvio(_exp_id);
            var lista = _seguimientoExpServicio.ObtenerIdMailPorUsuario(_username);
            T_MAIL_EXP dbMailExp = new T_MAIL_EXP()
            {
                 id_Expediente = IdExpEnvio,
                // id_Mails = lista.Sele
            };
    
asked by pj2016 17.03.2017 в 13:04
source

1 answer

1

You should simply create several objects T_MAIL_EXP one for each Id_Mail different and keeping the id_Expediente , then you persist in the way you have been persisting until now. Then in BD you will remain as you want:

Id Expediente   Id_Mail
51              17
51              58
    
answered by 17.03.2017 в 13:31