public IActionResult ResetPassword(String password, int id)

        {
            SystemUser ps = _context.SystemUser.Where(usr => usr.Id == id).FirstOrDefault();

            ps.Password = password;
            _context.Update(ps);
            _context.SaveChanges();

            if (ModelState.IsValid)
            {
                MailMessage mail = new MailMessage();
                mail.From = new MailAddress("*****@*****.**", "TheetPOS");
                mail.To.Add(ps.Email);
                mail.Subject    = "Welcome Back! " + ps.DisplayName;
                mail.Body       = "Your  New Password is: " + ps.Password + " </ br > ";
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host        = "smtp.gmail.com";
                smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "rizwan67");
                smtp.Port        = 587;
                smtp.EnableSsl   = true;
                smtp.Send(mail);
                ViewBag.passwordSend = "Your New password has been send to this email please check!";
                HttpContext.Session.Clear();
                return(RedirectToAction(nameof(Login)));
            }
            return(View());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Barcode,ShortDescription,LongDescription,Features,ProductBrandId,ProductCategoryId,CurrentSalePrice,LatestPurchasePrice,Images,Views,OpeningStock,OpeningDate,CurrentStock,Status,CreatedDate,CreatedBy,ModifiedDate,ModifiedBy")] Product product)
        {
            if (id != product.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,SaleDate,SalePrice,Discount,FinalPrice,Status,CreatedDate,CreatedBy,ModifiedDate,ModifiedBy")] ProductSale productSale)
        {
            if (id != productSale.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productSale);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductSaleExists(productSale.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(productSale));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Logo,Website,Description,Status,CreatedDate,CreatedBy,ModifiedDate,ModifiedBy")] ProductBrand productBrand)
        {
            if (id != productBrand.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productBrand);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductBrandExists(productBrand.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(productBrand));
        }