public AuthenticationModel Login([FromBody] AccountLoginModel model) { //var account = _readOnlyRepository.First<Account>(account1 => account1.Email == model.Email // && BCrypt.Net.BCrypt.Verify(model.Password, account1.Password)); var account = _readOnlyRepository.First <Account>(account1 => account1.Email == model.Email && account1.Password == model.Password); if (account != null) { var session = AccountHelpers.CreateNewSession(account); var sessionCreated = _writeOnlyRepository.Create(session); if (sessionCreated != null) { return new AuthenticationModel() { Token = session.Token, YourSessionExpireIn = session.Duration } } ; } throw new BadRequestException("User or Password is incorrect"); }
public ActionResult NewClassified(ClassifiedModel clasificado) { if (ModelState.IsValid) { switch (ValidateImagesVideo(clasificado)) { case true: break; case false: return(View(clasificado)); } var user = (string)Session["User"]; var usuario = _readOnlyRepository.FirstOrDefault <User>(x => x.Nombre == user); clasificado.IdUsuario = usuario.Id; var classified = new Classified { FechaCreacion = DateTime.Now.ToString("d"), Titulo = clasificado.Titulo, Categoria = clasificado.Categoria, IdUsuario = clasificado.IdUsuario, Negocio = clasificado.Negocio, Descripcion = clasificado.Descripcion, Precio = clasificado.Precio, UrlVideo = clasificado.UrlVideo, UrlImg0 = clasificado.UrlImg0, UrlImg1 = clasificado.UrlImg1, UrlImg2 = clasificado.UrlImg2, UrlImg3 = clasificado.UrlImg3, UrlImg4 = clasificado.UrlImg4, UrlImg5 = clasificado.UrlImg5, Recomendado = 1 }; _writeOnlyRepository.Create(classified); usuario.TotalClasificados += 1; _writeOnlyRepository.Update(usuario); var subscriptions = _readOnlyRepository.GetAll <Suscribtions>().ToList(); foreach (var sus in subscriptions) { var subs = _readOnlyRepository.GetById <User>(sus.IdUsuarioSuscrito); TwilioService.SendSmsToSubscribers(subs.Nombre, classified.Titulo, usuario.Nombre); } this.AddNotification("Clasificado registrado.", NotificationType.Success); return(RedirectToAction("Index", "Home")); } this.AddNotification("No se pudo crear clasificado.", NotificationType.Error); return(View(clasificado)); }
public ReturnModel CreateBoard([FromBody] AccountBoardsModel model, long idOrganization, string accesToken) { var account = _readOnlyRepository.First <Account>(account1 => account1.Token == accesToken); ReturnModel remodel = new ReturnModel(); if (account != null) { if (account.VerifyToken(account)) { Organization organization = _readOnlyRepository.GetById <Organization>(idOrganization); Board board = _mappingEngine.Map <AccountBoardsModel, Board>(model); board.Administrator = account; Board boardCreated = _writeOnlyRepository.Create(board); if (boardCreated != null) { organization.AddBoard(boardCreated); Activity activity = new Activity(); activity.Text = account.FirstName + " Creo un board"; account.AddActivities(activity); var organizacionUpdate = _writeOnlyRepository.Update(organization); var accountUpdate = _writeOnlyRepository.Update(account); return(remodel.ConfigureModel("Succesfull", "Se creo el board correctamente", remodel)); } return(remodel.ConfigureModel("Error", "No se pudo crear el board", remodel)); } return(remodel.ConfigureModel("Error", "Su session ya expiro", remodel)); } return(remodel.ConfigureModel("Error", "No se pudo acceder a su cuenta", remodel)); }
public ActionResult Index(Calculadora calculadora) { var operacion = new Operaciones(""); if (calculadora.Entrada.Contains("-")) { operacion.Operador = "-"; operacion.Numero1 = calculadora.Entrada.Split('-')[0]; operacion.Numero2 = calculadora.Entrada.Split('-')[1]; operacion.Resultado = _calc.Resta(calculadora.Entrada); } else if (calculadora.Entrada.Contains("+")) { operacion.Operador = "+"; operacion.Numero1 = calculadora.Entrada.Split('+')[0]; operacion.Numero2 = calculadora.Entrada.Split('+')[1]; operacion.Resultado = _calc.Suma(calculadora.Entrada); } calculadora.Salida = operacion.Resultado; var createdOperation = _writeOnlyRepository.Create(operacion); calculadora.Operaciones = _readOnlyRepository.GetAll <Operaciones>().ToList(); return(View(calculadora)); }
public ReturnModel Register([FromBody] OrganizationModel model, string accesToken) { var account = _readOnlyRepository.First <Account>( account1 => account1.Token == accesToken); ReturnModel remodel = new ReturnModel(); if (account != null) { if (account.VerifyToken(account)) { Organization organization = _mappingEngine.Map <OrganizationModel, Organization>(model); Organization organizationCreated = _writeOnlyRepository.Create(organization); if (organizationCreated != null) { account.AddOrganization(organizationCreated); Activity activity = new Activity(); activity.Text = account.FirstName + " Creo una organizacion"; account.AddActivities(activity); var accountUpdate = _writeOnlyRepository.Update(account); return(remodel.ConfigureModel("SuccessFull", "Se Creo satisfactoriamente la organizacion " + organizationCreated.Title, remodel));; } } return(remodel.ConfigureModel("Error", "Su session ya expiro", remodel)); } return(remodel.ConfigureModel("Error", "No se pudo acceder a su cuenta", remodel)); }
public SuccessfulMessageResponse CreateCard([FromBody] CardsCreationModel model, string token, long laneId) { var session = IsTokenExpired(token); var laneToAddCard = _readOnlyRepository.GetById <Lane>(laneId); var board = _readOnlyRepository.First <Board>(board1 => board1.Lanes.Contains(laneToAddCard)); var account = _readOnlyRepository.First <Account>(account1 => account1.Id == session.User.Id); if (laneToAddCard != null && account != null) { var cardToAdd = _mappingEngine.Map <CardsCreationModel, Card>(model); cardToAdd.IsArchived = false; cardToAdd.Position = laneToAddCard.Cards.Count() + 1; cardToAdd.AddMember(account); account.AddCard(cardToAdd); laneToAddCard.AddCards(cardToAdd); Card cardCreated = _writeOnlyRepository.Create(cardToAdd); if (cardCreated != null) { string activityDone = "Add " + cardCreated.Text + " to " + board.Title; board.AddActivity(ActivityHelper.CreateActivity(session.User, activityDone)); return(new SuccessfulMessageResponse("Lane was successfully created")); } } throw new BadRequestException("YThis Lane does not exist"); }
public ReturnModel CreateCard([FromBody] CardModel model, long idLine, string accesToken) { var account = _readOnlyRepository.First <Account>( account1 => account1.Token == accesToken); ReturnModel remodel = new ReturnModel(); if (account != null) { if (account.VerifyToken(account)) { Lines line = _readOnlyRepository.GetById <Lines>(idLine); Cards card = _mappingEngine.Map <CardModel, Cards>(model); Cards cardCreated = _writeOnlyRepository.Create(card); if (cardCreated != null) { line.AddCard(cardCreated); var lineUpdate = _writeOnlyRepository.Update(line); Activity activity = new Activity(); activity.Text = account.FirstName + " Creo una card en " + line.Title; account.AddActivities(activity); var accountUpdate = _writeOnlyRepository.Update(account); return(remodel.ConfigureModel("Successfull", "Se creo correctamente la card " + cardCreated.Text, remodel)); } return(remodel.ConfigureModel("Error", "No se pudo crear la card", remodel)); } return(remodel.ConfigureModel("Error", "Su session ya expiro", remodel)); } return(remodel.ConfigureModel("Error", "No se pudo acceder a la cuenta", remodel)); }
public ActionResult Follow(long id) { var activeUser = _readOnlyRepository.FirstOrDefault <AccountLogin>(x => x.Email == HttpContext.User.Identity.Name); var userprofile = _readOnlyRepository.FirstOrDefault <AccountLogin>(x => x.Id == id); var subscriptionToBeActivated = _readOnlyRepository.FirstOrDefault <Subscriptions>(x => x.Follower == activeUser.Id && x.Following == userprofile.Id); if (subscriptionToBeActivated != null) { subscriptionToBeActivated.Activate(); _writeOnlyRepository.Update(subscriptionToBeActivated); } else { _writeOnlyRepository.Create(new Subscriptions(activeUser.Id, userprofile.Id)); } var notify = new Notifications(activeUser.Email, activeUser.Name, "Subs"); var list = userprofile.Notifications.ToList(); list.Add(notify); userprofile.Notifications = list; _writeOnlyRepository.Update(userprofile); return(RedirectToAction("PublicProfile", new{ id })); }
public ActionResult CreateEditPackage(PackageModel model) { if (Convert.ToBoolean(Session["createPackageIsActive"])) { var newPackage = new Package { Id = model.Id, IsArchived = model.IsArchived, Name = model.Name, Description = model.Description, Price = model.Price, SpaceLimit = model.SpaceLimit, CreationDate = DateTime.Now.Date, DaysAvailable = model.DaysAvailable }; _writeOnlyRepository.Create(newPackage); } else { var packageData = _readOnlyRepository.GetById <Package>(model.Id); packageData.Name = model.Name; packageData.SpaceLimit = model.SpaceLimit; packageData.IsArchived = model.IsArchived; packageData.Price = model.Price; packageData.Description = model.Description; packageData.DaysAvailable = model.DaysAvailable; _writeOnlyRepository.Update(packageData); } return(RedirectToAction("PackageList", "PackageList")); }
public ActionResult NewProject(NewProjectModel model) { if (ModelState.IsValid) { HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); var user = _readOnlyRepository.FirstOrDefault <User>(x => x.Email == authTicket.UserData); if (user != null) { var project = _readOnlyRepository.FirstOrDefault <ProjectEntity>(x => x.ProjectName == model.ProjectName && x.UserId == user.Id); if (project == null) { var newProjectItem = new ProjectEntity { ProjectName = model.ProjectName, UserId = user.Id, ProjectDescription = model.ProjectDescription }; newProjectItem = _writeOnlyRepository.Create(newProjectItem); Session["CurrentViewProjectID"] = newProjectItem.Id; Session["CurrentViewProjectName"] = newProjectItem.ProjectName; return(RedirectToAction("Index")); } ModelState.AddModelError("", "A project with that name already exists!"); } } } return(View(model)); }
public ReturnModel CreateLine([FromBody] LineModel model, long idBoard, string accesToken) { var account = _readOnlyRepository.First <Account>(account1 => account1.Token == accesToken); ReturnModel remodel = new ReturnModel(); if (account != null) { if (account.VerifyToken(account)) { Board board = _readOnlyRepository.GetById <Board>(idBoard); Lines line = _mappingEngine.Map <LineModel, Lines>(model); Lines lineCreated = _writeOnlyRepository.Create(line); if (lineCreated != null) { board.AddLine(lineCreated); var boardUpdate = _writeOnlyRepository.Update(board); Activity activity = new Activity(); activity.Text = account.FirstName + " Creo una Line en " + board.Title; account.AddActivities(activity); var accountUpdate = _writeOnlyRepository.Update(account); return(remodel.ConfigureModel("Successfull", "Se creo exitosamente la line " + lineCreated.Title, remodel)); } return(remodel.ConfigureModel("Error", "No se pudo crear la line", remodel)); } return(remodel.ConfigureModel("Error", "Su session ya expiro", remodel)); } return(remodel.ConfigureModel("Error", "No se pudo acceder a su cuenta", remodel)); }
public CreatedAccountModel Register([FromBody] AccountRegisterModel model) { var newUser = _mappingEngine.Map <AccountRegisterModel, Account>(model); var createdUser = _writeOnlyRepository.Create(newUser); var craetedUserModel = _mappingEngine.Map <Account, CreatedAccountModel>(createdUser); return(craetedUserModel); }
public Account Register([FromBody] AccountRegisterModel model) { var newUser = _mappingEngine.Map <AccountRegisterModel, Account>(model); var createdUser = _writeOnlyRepository.Create(newUser); var x = Request; return(createdUser); }
public CreatedAccountModel Register([FromBody] AccountRegisterModel model) { EmailWithMailgun.SendMessage("Correo", model.Email, "Hola"); var newUser = _mappingEngine.Map <AccountRegisterModel, Account>(model); var createdUser = _writeOnlyRepository.Create(newUser); var craetedUserModel = _mappingEngine.Map <Account, CreatedAccountModel>(createdUser); return(craetedUserModel); }
public ActionResult Create(DepartamentoModel model) { if (ModelState.IsValid) { _writeOnlyRepository.Create(Mapper.Map <Departamento>(model)); Success("Depto agregado"); return(RedirectToAction("Index")); } Error("there were some errors in your form."); return(View(model)); }
public ActionResult Register(AccountInputModel model) { var account = Mapper.Map <AccountInputModel, Account>(model); account.IsConfirm = false; account.HashConfirmation = CreateHastConfirmationString(); account = _writeOnlyRepository.Create(account); //enviar email para confirmar // si paso el email return(View()); }
public ActionResult FrequentQuestions(QuestionModel question) { if (ModelState.IsValid) { var qA = new QuestionAnswer { Fecha = DateTime.Now.ToString("d"), Correo = question.Correo, Nombre = question.Nombre, Pregunta = question.Pregunta, Respuesta = "none" }; _writeOnlyRepository.Create(qA); this.AddNotification("Hemos recibido su pregunta. Le contestaremos con la mayor brevedad posible.", NotificationType.Success); MailService.SendQuestionMessage(question.Correo, question.Nombre, question.Pregunta); question.PreguntasFrecuentes = _readOnlyRepository.GetAll <QuestionAnswer>().ToList(); return(View(question)); } this.AddNotification("Pregunta Invalida!", NotificationType.Warning); question.PreguntasFrecuentes = _readOnlyRepository.GetAll <QuestionAnswer>().ToList(); return(View(question)); }
public ActionResult FAQ(QuestionModel model) { var questionToBePushed = new Questions(model.QuestionText, model.Email, model.Name); _writeOnlyRepository.Create(questionToBePushed); //check MessageBox.Show("Question Added Succesfully"); var questionsList = _readOnlyRepository.GetAll <Questions>().Where(x => !x.Archived).ToList(); questionsList.Reverse(); model.QuestionList = questionsList; return(View(model)); }
private string CreateTokenForUser(string userName) { var account = _readOnlyRepository.First <Account>(x => x.EMail == userName); if (checkCuenta(account)) { var tokenString = EncriptacionMD5.Encriptar(userName) + GetHashCode(); var key = new ApiKeys(); key.ExpirationTime = MinutesPermission(); key.UserId = account.Id; key.Token = tokenString; _writeOnlyRepository.Create(key); return(key.Token); } return("Credenciales invalidas"); }
public ReturnModel Register([FromBody] AccountRegisterModel model) { ReturnModel remodel = new ReturnModel(); if (model.Password != model.ConfirmPassword) { return(remodel.ConfigureModel("Error", "Las Claves no son iguales", remodel)); } if (model.Password.Length <= 6 || Regex.IsMatch(model.Password, @"^[a-zA-Z]+$")) { return(remodel.ConfigureModel("Error", "la clave debe ser mayor a 6 caracteres y debe contener almenos un numero", remodel)); } var accountExist = _readOnlyRepository.First <Account>(account1 => account1.Email == model.Email); if (accountExist == null) { Account account = _mappingEngine.Map <AccountRegisterModel, Account>(model); account.TokenTime = DateTime.Now; account.Password = Encrypt(account.Password); Account accountCreated = _writeOnlyRepository.Create(account); if (accountCreated != null) { ReturnRegisterModel registermodel = _mappingEngine.Map <Account, ReturnRegisterModel>(account); RestClient client = new RestClient(); client.BaseUrl = "https://api.mailgun.net/v2"; client.Authenticator = new HttpBasicAuthenticator("api", "key-3v0eblygcsga9qlj7tnn34w0vk14q-k3"); RestRequest request = new RestRequest(); request.AddParameter("domain", "app6870.mailgun.org", ParameterType.UrlSegment); request.Resource = "{domain}/messages"; request.AddParameter("from", "MiniTrello <*****@*****.**>"); request.AddParameter("to", model.Email); request.AddParameter("to", model.Email); request.AddParameter("subject", "Registrado"); request.AddParameter("text", "Bienvenido a MiniTrello " + model.FirstName + "!"); request.Method = Method.POST; client.Execute(request); return(remodel.ConfigureModel("Successfull", "Se Registro Correctamente", registermodel)); } return(remodel.ConfigureModel("Error", "Error al Guardar el Usuario", remodel)); } return(remodel.ConfigureModel("Error", "Usuario ya existe", remodel)); }
public AuthModel signup([FromBody] RegisterModel model) { Account ac = new Account(); ac.Name = model.DisplayName; ac.Email = model.Email; ac.Password = model.Password; var newUser = ac; var createdUser = _writeOnlyRepository.Create(newUser); var resp = SendSimpleMessage(model.Email, model.FirstName, model.LastName, model.DisplayName); var authModel = new AuthModel { Token = "SuperHash" }; return(authModel); }
public SuccessfulMessageResponse CreateLane([FromBody] LanesCreationModel model, string token, long boardId) { var session = IsTokenExpired(token); var boardToAddLane1 = _readOnlyRepository.GetById <Board>(boardId); if (boardToAddLane1 != null) { var laneToAdd = _mappingEngine.Map <LanesCreationModel, Lane>(model); laneToAdd.IsArchived = false; laneToAdd.Position = boardToAddLane1.Lanes.Count() + 1; boardToAddLane1.AddLanes(laneToAdd); Lane laneCreated = _writeOnlyRepository.Create(laneToAdd); if (laneCreated != null) { return(new SuccessfulMessageResponse("Lane was succesfully created")); } } throw new BadRequestException("Lane could not be created"); }
public ActionResult Register(RegisterModel rModel) { if (ModelState.IsValid) { var user = _readOnlyRepository.FirstOrDefault <AccountLogin>(x => x.Email == rModel.Email); if (user != null) { //check MessageBox.Show("User Exists."); } else { var registeredAccount = new AccountLogin(rModel.Email, rModel.Name, (new Hasher()).Encrypt(rModel.Password), "user"); _writeOnlyRepository.Create(registeredAccount); MailTo.SendSimpleMessage(rModel.Email, rModel.Name, "Gracias por Registrarse"); } ModelState.AddModelError("", "Something went wrong with your credentials."); } return(View(rModel)); }
public AuthModel admin([FromBody] adminModel model) { League lea = new League(); lea.Name = model.Name; lea.Day = model.Day; lea.Location = model.Location; var newLeague = lea; var createdLeague = _writeOnlyRepository.Create(newLeague); var authModel = new AuthModel { }; return(authModel); }
public ActionResult Contact(ContactModel contact) { if (!this.IsCaptchaValid("Captcha is not valid")) { return(View(contact)); } if (ModelState.IsValid) { var contt = new ContactInfo { Nombre = contact.Nombre, Correo = contact.Correo, Mensaje = contact.Mensaje }; _writeOnlyRepository.Create(contt); MailService.SendContactMessage(contact.Correo, contact.Nombre, contact.Mensaje); this.AddNotification("Se ha recibido el mensaje.", NotificationType.Success); return(View(contact)); } this.AddNotification("No se a podido enviar su pregunta!", NotificationType.Warning); return(View(contact)); }
public ActionResult Register(AccountRegisterModel model) { if (ModelState.IsValid) { var testEmail = _readOnlyRepository.FirstOrDefault <User>(x => x.Email == model.Email); if (testEmail != null) { ModelState.AddModelError("", "An account with that e-mail address already exists!"); return(View(model)); } var newUser = new User { Email = model.Email, Name = model.Name, Password = model.Password, IsAdmin = false }; PasswordEncryptionService.Encrypt(newUser); _writeOnlyRepository.Create(newUser); return(RedirectToAction("Login")); } return(View(model)); }
public BoardModel CreateBoard([FromBody] BoardsCreationModel model, string token, long idOrganization) { var session = IsTokenExpired(token); var account = _readOnlyRepository.First <Account>(account1 => account1.Id == session.User.Id); var organization = _readOnlyRepository.GetById <Organization>(idOrganization); var boardToAdd = _mappingEngine.Map <BoardsCreationModel, Board>(model); boardToAdd.Administrador = account; boardToAdd.AddMember(account); boardToAdd.IsArchived = false; account.AddBoard(boardToAdd); organization.AddBoard(boardToAdd); Board boardCreated = _writeOnlyRepository.Create(boardToAdd); if (boardCreated != null) { string activityDone = "Add " + boardToAdd.Title; boardToAdd.AddActivity(ActivityHelper.CreateActivity(session.User, activityDone)); return(new BoardModel { Title = boardCreated.Title, Id = boardCreated.Id }); } throw new BadRequestException("The board could not be created"); }
internal bool PostPaypal(string tx, string producto) { var httpRequest = WebRequest.Create("https://www.sandbox.paypal.com/cgi-bin/webscr") as HttpWebRequest; if (httpRequest != null) { httpRequest.Method = "POST"; httpRequest.ProtocolVersion = HttpVersion.Version11; httpRequest.ContentType = "application/x-www-form-urlencoded"; using (Stream requestStream = httpRequest.GetRequestStream()) { byte[] parametersBuffer = Encoding.ASCII.GetBytes( "cmd=_notify-synch&tx=" + tx + "&at=wm1BBPJzvOKS7VC0u3pUVnlwwwHHlRBtYGNcowtpX-hOr6PLVQIIbeMhYQa"); requestStream.Write(parametersBuffer, 0, parametersBuffer.Length); } var httpResponse = httpRequest.GetResponse(); var streamReader = new StreamReader(httpResponse.GetResponseStream()); var resultHtml = streamReader.ReadToEnd(); if (resultHtml.Contains("SUCCES")) { var account = _readOnlyRepository.First <Account>(x => x.EMail == User.Identity.Name); var _tranVent = new RecibosVentas { Transaccion = tx, UserCompro = account.EMail, IsArchived = false, Fecha = DateTime.Now }; if (producto == "200 GB") { account.SpaceLimit = account.SpaceLimit + 204800; _tranVent.Total = 30; _tranVent.Descripcion = "Compra de 200 GB"; } else if (producto == "500 GB") { account.SpaceLimit = account.SpaceLimit + 512000; _tranVent.Total = 100; _tranVent.Descripcion = "Compra de 500 GB"; } _tranVent = _writeOnlyRepository.Create <RecibosVentas>(_tranVent); account.RecibosVentas_Id = _tranVent.Id; _writeOnlyRepository.Update <Account>(account); return(true); } else { #region EnvioMail var emailBody = new StringBuilder("<b>paypal payment failure, so active an account is free </b>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); emailBody.Append("<b>paypal payment failure, so active an account is free " + DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + "</b>"); MailSender.SendEmail(User.Identity.Name, "Activation Free", emailBody.ToString()); #endregion return(false); } } return(false); }
public ActionResult AccountSignUp(AccountSignUpModel model) { var result = _readOnlyRepository.Query <Account>(a => a.EMail == model.EMail); if (result.Any()) { Error("Email account is already registered in this site!!!"); return(View(model)); } var account = Mapper.Map <Account>(model); account.IsArchived = false; account.IsAdmin = false; account.IsBlocked = false; account.SpaceLimit = 2408; account.Password = EncriptacionMD5.Encriptar(model.Password); account.Isconfirmed = false; account.BucketName = string.Format("mdp.{0}", Guid.NewGuid()); //var account = new Account //{ // Name = accountModel.Name, // LastName = accountModel.LastName, // EMail = accountModel.EMail, // IsArchived = false, // IsBlocked = false, // SpaceLimit = 500, // UsedSpace = 0, // Password = EncriptacionMD5.Encriptar(accountModel.Password) //}; //account.AddRole(new Role{Name = "User",IsArchived = false}); var createdAccount = _writeOnlyRepository.Create(account); var token = Convert.ToInt64(Session["userReferralId"]); if (token != 0) { var userReferring = _readOnlyRepository.GetById <Account>(token); userReferring.Referrals.Add(createdAccount); _writeOnlyRepository.Update(userReferring); } var serverFolderPath = Server.MapPath("~/App_Data/UploadedFiles/" + account.EMail); Directory.CreateDirectory(serverFolderPath); var newBucket = new PutBucketRequest { BucketName = account.BucketName }; AWSClient.PutBucket(newBucket); var putFolder = new PutObjectRequest { BucketName = account.BucketName, Key = "Shared/", ContentBody = string.Empty }; AWSClient.PutObject(putFolder); var sharedDirectory = serverFolderPath + "/Shared"; Directory.CreateDirectory(sharedDirectory); //var serverFolderPath = Server.MapPath("~/App_Data/UploadedFiles/" + account.EMail); //Directory.CreateDirectory(serverFolderPath); //var sharedDirectory =serverFolderPath + "/Shared"; //Directory.CreateDirectory(sharedDirectory); if (createdAccount.Files == null) { createdAccount.Files = new List <Domain.File>(); } if (createdAccount.History == null) { createdAccount.History = new List <Actividades>(); } createdAccount.Files.Add(new Domain.File { CreatedDate = DateTime.Now, FileSize = 0, IsArchived = false, IsDirectory = true, Name = "Shared", Url = "", Type = "", ModifiedDate = DateTime.Now }); _writeOnlyRepository.Update(createdAccount); AddActivity("El usuario se registro.", createdAccount); // ESTOOOOOOO #region EnvioCorreoParaNotificacion var fechaActual = DateTime.Now.Date; var pass = result.FirstOrDefault().Id; var data = "" + fechaActual.Day + fechaActual.Month + fechaActual.Year; var tokenConfir = pass + ";" + EncriptacionMD5.Encriptar(data); //var url = "http://minidropbox-1.apphb.com/PasswordReset/PasswordReset"; var url = "http://minidropboxclase.apphb.com/Account/Confirmed"; var emailBody = new StringBuilder("<b>Confirm your account of MiniDropbox</b>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); emailBody.Append("<b>" + url + "?token=" + tokenConfir + "<b>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); emailBody.Append("<b>This link is only valid through " + DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + "</b>"); if (MailSender.SendEmail(model.EMail, "Confirm your account of MiniDropbox", emailBody.ToString())) { return(Cancelar()); } Error("E-Mail failed to be sent, please try again!!!"); return(View(model)); #endregion return(Cancelar()); }
public ActionResult AccountSignUp(AccountSignUpModel model) { var result = _readOnlyRepository.Query <Account>(a => a.EMail == model.EMail); if (result.Any()) { Error("Email account is already registered in this site!!!"); return(View(model)); } var account = Mapper.Map <Account>(model); account.IsArchived = false; account.IsAdmin = false; account.IsBlocked = false; account.Password = EncriptacionMD5.Encriptar(model.Password); account.Isconfirmed = false; var createdAccount = _writeOnlyRepository.Create(account); var token = Convert.ToInt64(Session["userReferralId"]); if (token != 0) { var userReferring = _readOnlyRepository.GetById <Account>(token); userReferring.Referrals.Add(createdAccount); _writeOnlyRepository.Update(userReferring); } var serverFolderPath = Server.MapPath("~/App_Data/UploadedFiles/" + account.EMail); Directory.CreateDirectory(serverFolderPath); // ESTOOOOOOO #region EnvioCorreoParaNotificacion var fechaActual = DateTime.Now.Date; var pass = result.FirstOrDefault().Id; var data = "" + fechaActual.Day + fechaActual.Month + fechaActual.Year; var tokenConfir = pass + ";" + EncriptacionMD5.Encriptar(data); //var url = "http://Galeria-1.apphb.com/PasswordReset/PasswordReset"; var url = "http://Galeriaclase.apphb.com/Account/Confirmed"; var emailBody = new StringBuilder("<b>Confirm your account of Galeria</b>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); emailBody.Append("<b>" + url + "?token=" + tokenConfir + "<b>"); emailBody.Append("<br/>"); emailBody.Append("<br/>"); emailBody.Append("<b>This link is only valid through " + DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + "</b>"); if (MailSender.SendEmail(model.EMail, "Confirm your account of Galeria", emailBody.ToString())) { return(Cancelar()); } Error("E-Mail failed to be sent, please try again!!!"); return(View(model)); #endregion return(Cancelar()); }