Пример #1
0
        public ActionResult Create(PrototipoVM prototipoVM)
        {
            if (ModelState.IsValid)
            {
                PrototipoDomainModel prototipoDM = new PrototipoDomainModel();

                string nombre     = SessionPersister.AccountSession.NombreCompleto;
                int    idPersonal = SessionPersister.AccountSession.IdPersonal;

                prototipoVM.idPersonal = idPersonal;

                AutoMapper.Mapper.Map(prototipoVM, prototipoDM);

                object[] obj = CrearDocumentoPersonales(prototipoVM);

                if (obj[0].Equals(true))
                {
                    prototipoDM.documentos = new DocumentosDomainModel {
                        StrUrl = obj[1].ToString()
                    };
                    prototipoBusiness.AddUpdatePrototipo(prototipoDM);
                }
            }

            return(RedirectToAction("Create", "Prototipo"));
        }
Пример #2
0
        public ActionResult UpdatePrototipo(PrototipoVM prototipoVM)
        {
            PrototipoDomainModel prototipoDM = new PrototipoDomainModel();

            if (prototipoVM.id > 0)
            {
                AutoMapper.Mapper.Map(prototipoVM, prototipoDM);

                prototipoBusiness.AddUpdatePrototipo(prototipoDM);
            }

            return(RedirectToAction("Create", "Prototipo"));
        }
Пример #3
0
        public ActionResult GetPropositoUpdate(int _idPrototipo)
        {
            PrototipoDomainModel prototipoDM = new PrototipoDomainModel();

            prototipoDM = prototipoBusiness.GetPrototipoById(_idPrototipo);

            if (prototipoDM != null)
            {
                PrototipoVM prototipoVM = new PrototipoVM();

                AutoMapper.Mapper.Map(prototipoDM, prototipoVM);

                return(PartialView("_Editar", prototipoVM));
            }

            return(PartialView("_Editar"));
        }
Пример #4
0
        public ActionResult DeletePrototipo(PrototipoVM prototipoVM)
        {
            PrototipoDomainModel prototipoDM = new PrototipoDomainModel();

            prototipoDM = prototipoBusiness.GetPrototipoById(prototipoVM.id);

            if (prototipoDM != null)
            {
                string url = Server.MapPath(Recursos.RecursosSistema.DOCUMENTO_USUARIO + SessionPersister.AccountSession.NombreCompleto + "/" + prototipoDM.documentos.StrUrl);
                if (FileManager.FileManager.DeleteFileFromServer(url))
                {
                    documentosBusiness.DeleteDocumento(prototipoDM.idDocumento);
                }
            }

            return(RedirectToAction("Create", "Prototipo"));
        }
Пример #5
0
        private Object[] CrearDocumentoPersonales(PrototipoVM prototipoVM)
        {
            Object[] respuesta = new Object[2];
            prototipoVM.idPersonal = SessionPersister.AccountSession.IdPersonal;
            string nombrecompleto = SessionPersister.AccountSession.NombreCompleto;
            string path           = Path.Combine(Server.MapPath(Recursos.RecursosSistema.DOCUMENTO_USUARIO + nombrecompleto));

            if (Directory.Exists(path))
            {
                if (prototipoVM.documentos.DocumentoFile != null)
                {
                    respuesta = FileManager.FileManager.CheckFileIfExist(path, prototipoVM.documentos);
                }
            }
            else
            {
                DirectoryInfo directoryInfo = Directory.CreateDirectory(path);
                CrearDocumentoPersonales(prototipoVM);
            }

            return(respuesta);
        }