public IActionResult Create(AgentReview AgentReview) { if (ModelState.IsValid) { AgentReview.CreatedBy = _admin.Fullname; _AgentReview.CreateAgentReview(AgentReview); return(RedirectToAction("index")); } return(View(AgentReview)); }
public IActionResult SingleAgent(Category catgory) { if (catgory.Id == 9999) { var message = new MimeMessage(); message.From.Add(new MailboxAddress(catgory.Name, "*****@*****.**")); message.To.Add(new MailboxAddress("System", catgory.ModifiedBy)); message.Subject = catgory.Name + "/" + catgory.othrId.ToString(); message.Body = new TextPart("plain") { Text = catgory.CreatedBy }; using (var client = new SmtpClient()) { client.Connect("smtp.gmail.com", 587, false); client.Authenticate("*****@*****.**", "Hack2019@"); client.Send(message); client.Disconnect(true); } return(RedirectToAction("successPage", "property")); } else { AgentReview model = new AgentReview { CreatedBy = catgory.CreatedBy, Status = true, Star = (byte)catgory.Id, Name = catgory.CreatedBy, Comment = catgory.Name, AgentId = Int32.Parse(catgory.ModifiedBy) }; var routevaule = new { id = catgory.catId, agentId = Int32.Parse(catgory.ModifiedBy) }; if (ModelState.IsValid) { _agentReviewRepository.CreateAgentReview(model); return(RedirectToAction("singleagent", "agent", routevaule)); } return(RedirectToAction("singleagent", "agent", routevaule)); } }