Beispiel #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,DrawersId,Rank")] Cartoon cartoon)
        {
            if (id != cartoon.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cartoon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CartoonExists(cartoon.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DrawersId"] = new SelectList(_context.Drawer, "Id", "Name", cartoon.DrawersId);
            return(View(cartoon));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,ProjectKey,VersionNumber,UpdateRequired")] Settings settings)
        {
            if (id != settings.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(settings);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SettingsExists(settings.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(settings));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Password,Email")] Users users)
        {
            if (id != users.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Token,Device,CreateDate")] NotificationToken notificationToken)
        {
            if (id != notificationToken.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(notificationToken);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NotificationTokenExists(notificationToken.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(notificationToken));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,CartoonId,UniqUserKey")] CartoonLikes cartoonLikes)
        {
            if (id != cartoonLikes.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cartoonLikes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CartoonLikesExists(cartoonLikes.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CartoonId"] = new SelectList(_context.Cartoon, "Id", "Id", cartoonLikes.CartoonId);
            return(View(cartoonLikes));
        }
Beispiel #6
0
        public async Task <ActionResult> SendPassword(Users users)
        {
            if (_env.IsDevelopment())
            {
                return(RedirectToAction("Index", new { pageType = 0, Email = users.Email, GetPassword = true }));
            }
            var password = Guid.NewGuid();
            var user     = _context.Users.FirstOrDefault(x => x.Email == users.Email);

            if (user != null && !string.IsNullOrEmpty(user.Email))
            {
                user.Password = password;
                user.PasswordExpirationDate = DateTime.Now.AddMinutes(10);
                _context.Update(user);
                if (await _context.SaveChangesAsync() > 0)
                {
                    var fromAddress = new MailAddress("*****@*****.**", "Karikatür - Admin Parola" + DateTime.Now.ToString());
                    var toAddress   = new MailAddress(users.Email, "Parola");

                    var smtp = new SmtpClient
                    {
                        Host                  = "smtp.gmail.com",
                        Port                  = 587,
                        EnableSsl             = true,
                        DeliveryMethod        = SmtpDeliveryMethod.Network,
                        UseDefaultCredentials = false,
                        Credentials           = new NetworkCredential(fromAddress.Address, "xz06pl54Cer32.")
                    };
                    using (var message = new MailMessage(fromAddress, toAddress)
                    {
                        Subject = "Parolanız - " + DateTime.Now.ToString(),
                        Body = "<p style='font-size:25px'>" + password + "</p>",
                        IsBodyHtml = true
                    })
                        try
                        {
                            smtp.Send(message);
                        }
                        catch (Exception err)
                        {
                            return(RedirectToAction("Index", new { pageType = 1, Email = users.Email, ErrorText = err.Message }));
                        }
                    return(RedirectToAction("Index", new { pageType = 0, Email = users.Email, GetPassword = true }));
                }
            }
            return(RedirectToAction("Index", new { pageType = 2, Email = users.Email }));
        }
Beispiel #7
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,CartoonId,ImageSrc")] CartoonImages cartoonImages)
        {
            if (id != cartoonImages.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cartoonImages);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CartoonImagesExists(cartoonImages.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CartoonId"] = new SelectList(_context.Cartoon.OrderByDescending(x => x.Rank), "Id", "Id", cartoonImages.CartoonId);
            var allFiles = Directory.GetFiles($"{_env.WebRootPath}/Image/", "*.*", SearchOption.AllDirectories).ToList();

            for (int i = 0; i < allFiles.Count; i++)
            {
                allFiles[i] = allFiles[i].Replace(_env.WebRootPath, "");
            }
            ViewData["allFiles"] = allFiles;
            return(View(cartoonImages));
        }
Beispiel #8
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,LogoSrc,Name")] Drawer drawer)
        {
            if (id != drawer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(drawer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DrawerExists(drawer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            var allFiles = Directory.GetFiles($"{_env.WebRootPath}/Image/", "*.*", SearchOption.AllDirectories).ToList();

            for (int i = 0; i < allFiles.Count; i++)
            {
                allFiles[i] = allFiles[i].Replace(_env.WebRootPath, "");
            }
            ViewData["allFiles"] = allFiles;
            return(View(drawer));
        }