public ActionResult Shared(FolderPublicoModel2 model) { var file = _readOnlyRepository.First <File>(x => x.Id == Convert.ToInt64(Session["IDARCHIVOCOMPARTIR"])); var exisfshared = _readOnlyRepository.First <FileShared>(x => x.UserReceive == model.Email); if (exisfshared != null) { file.FileShared_id = exisfshared.Id; file.IsShared = true; _writeOnlyRepository.Update <File>(file); } else { var fshared = new FileShared(); fshared.AddFile(file); fshared.IsArchived = false; fshared.UserShared = User.Identity.Name; fshared.UserReceive = model.Email; var cfshared = _writeOnlyRepository.Create <FileShared>(fshared); file.FileShared_id = cfshared.Id; file.IsShared = true; _writeOnlyRepository.Update <File>(file); AddActivity("El usuario ha compartido el siguiente archivo: " + file.Name); } #region Envio de Mail o Invitacion var accoun = _readOnlyRepository.First <Account>(x => x.EMail == model.Email); var accounActual = _readOnlyRepository.First <Account>(x => x.EMail == User.Identity.Name); if (accoun != null) { var emailBody = new StringBuilder("<b>Se ha compartido el archivo: </b>"); emailBody.Append("<b>" + accounActual.Name + " " + accounActual.LastName + "</b>"); emailBody.Append( "<b> Se ha compartido el archivo: " + file.Name + "!!" + "</b>"); emailBody.Append("<br/>"); emailBody.Append( "<b>Ingrese a MiniDropbox, ingrese en su carpeta 'Shared' para descargarlo.!!! </b>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); if (MailSender.SendEmail(model.Email, "Join Mini DropBox", emailBody.ToString())) { Success("Shared sent successfully!!"); return(PartialView(model)); } Error("E-Mail couldn't be sent!!!!"); } else { var userData = _readOnlyRepository.First <Account>(x => x.EMail == User.Identity.Name); var emailBody = new StringBuilder("<b>Your friend </b>"); emailBody.Append("<b>" + userData.Name + " " + userData.LastName + "</b>"); emailBody.Append( "<b> Se ha compartido el archivo: " + file.Name + "!!" + "</b>"); emailBody.Append( "<b> wants you to join to MiniDropBox, a site where you can store your files in the cloud!!</b>"); emailBody.Append("<br/>"); emailBody.Append( "<b>To register in the site just click on the link below and fill up a quick form! Enjoy!!! </b>"); //emailBody.Append("http://minidropbox-1.apphb.com/AccountSignUp/AccountSignUp?token=" + userId); emailBody.Append("http://localhost:1840/AccountSignUp/AccountSignUp?token=" + userData.Id); emailBody.Append("<br/>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); if (MailSender.SendEmail(model.Email, "Join Mini DropBox", emailBody.ToString())) { Success("E-Mail sent successfully!!"); return(PartialView(model)); } Error("E-Mail couldn't be sent!!!!"); } #endregion Success("Archivo Compartido Correctamente"); return(RedirectToAction("ListAllContent")); }
public void FileShared(FileShared m) { }