public Customer Registration(Customer Customer) { try { if (repository.IsExist(x => x.UserName == Customer.UserName || x.Email == Customer.Email)) { Customer.Id = -1; return(Customer); } else { repository.AddEntity(Customer); string Email = Customer.Email; string userName = Customer.UserName; string subject = "welcome to mydeal"; string emailBody = " thanks you very much . it is your password "; email.Email(Email, userName, subject, emailBody); repository.SaveToDatabase(); return(Customer); } } catch (Exception) { throw; } }
public ActionResult SendingMail(Email email) { try { var customerInfo = dbContext.customers.FirstOrDefault(x => x.Id == email.CustomerId); string Email = customerInfo.Email; string UserName = customerInfo.UserName; string MailSubject = "welcome Sir"; string MailBody = " your bidded this product. ProductId: " + email.ProductId + " ProductName:" + email.ProductName + " .you are highest bidder .so you are selected for this product. welcome to you for win. Please collect your product."; _email.Email(Email, UserName, MailSubject, MailBody); TempData["sm"] = "succesful"; return(RedirectToAction("AllWinner")); } catch (Exception) { TempData["sm"] = "failed"; return(RedirectToAction("AllWinner")); } }