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")); }
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")); }
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")); }
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")); }
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); }