Exemple #1
0
        public IActionResult Email()
        {
            ViewBag.Emailresponse = "Before sending - ";
            try
            {
                var message = SendSimpleMessageChunk.SendSimpleMessage().Content.ToString();
                ViewBag.Emailresponse += "Simple Message sent - - - " + message;
            }
            catch (Exception e)
            {
                //catch errors
                ViewBag.Emailresponse += "Simple errors " + e.ToString();
            }

            //try
            //{
            //    SendSMTP.SendMessageSmtp();
            //    ViewBag.Emailresponse += " SMTP sent ";
            //}
            //catch (Exception e)
            //{
            //    //catch errors
            //    ViewBag.Emailresponse += " SMTP errors " + e.ToString();
            //}

            return(View());
        }
Exemple #2
0
        public async Task <IActionResult> Create(Quote quote)
        {
            if (ModelState.IsValid)
            {
                quote.Id     = 0;
                quote.TechId = 1;
                _context.Quotes.Add(quote);
                await _context.SaveChangesAsync();

                if (this.User.IsInRole("Tech"))
                {
                    var response2 = SendSimpleMessageChunk.SendPartMessage();
                }
                return(RedirectToAction("Create", "Service"));
            }
            return(View(quote));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, Quote quote)
        {
            if (id != quote.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(quote);
                    await _context.SaveChangesAsync();

                    if (this.User.IsInRole("Tech"))
                    {
                        var response = SendSimpleMessageChunk.SendPartMessage();
                    }
                    if (this.User.IsInRole("Parts"))
                    {
                        var responseTech = SendSimpleMessageChunk.SendTechMessage();
                    }
                    if (this.User.IsInRole("Tech") && quote.IsComplete == true)
                    {
                        var finalResponse = SendSimpleMessageChunk.SendFinalMessage();
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QuoteExists(quote.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(quote));
        }