Beispiel #1
0
 public virtual void AddSubFolder(Directories dir)
 {
     if (!_subfolder.Contains(dir))
     {
         _subfolder.Add(dir);
     }
 }
Beispiel #2
0
        public List<DiskContentModel> GetContentList(Directories dir)
        {
            var listOfDirectories = dir.SubFolder.ToList();
            var listOfContent = new List<DiskContentModel>();

            foreach (var dirs in listOfDirectories)
            {
                listOfContent.Add(Mapper.Map<Directories, DiskContentModel>(dirs));
            }
            return listOfContent;
        }
        public ActionResult registerAccount(AccountRegisterModel model)
        {
            //Mapper.CreateMap<AccountRegisterModel, Account>().ForMember(x => x.FirstName, o => o.MapFrom(y => y.FirstName));
            if (checkCuenta(model.Email))
            {
                Error("El correo '" + model.Email + "' ya existe.");

                return RedirectToAction("LogIn", "Account");
            }
            else if (!checkPassword(model.Password, model.ConfirmPassword))
            {
                Error("Contrasenas no validas: \n" +
                      "1. Las Contraseñas deben coincidir \n" +
                      "2. Las Contraseñas deben ser alfanumericas \n" +
                      "3. La Contraseña debe ser minimo 6 digitos"
                      );
                return View(new AccountRegisterModel());
            }
            else
            {
                var account = Mapper.Map<AccountRegisterModel, Account>(model);
                var directory = new Directories();
                directory.Name = account.Email;
                directory.ModifiedDate = DateTime.Now.ToString();
                directory.FileType = "Folder";

                _writeOnlyRepository.Create(directory);
                var dire = _readOnlyRepository.First<Directories>(x => x.Name == account.Email);
                account.RootId = dire.Id;
                dire.Name = "root";
                _writeOnlyRepository.Update(dire);
                account.Admin = false;
                account.Space = 5;
                account.Banned = false;
                _writeOnlyRepository.Create(account);
                _emailHandler.SendEmail(model.Email, "Bienvenido a MiniDropbox","Bienvenido a minidropbox, te has registrado bien.");
                Success("El usuario " + model.FirstName + " ha sido registrado.");
                return RedirectToAction("LogIn", "Account");
            }

            //RedirectToAction("RegisterAccount", "Account");
        }