public ActionResult DeleteConfirmed(int id)
        {
            AgentReview agentReview = db.AgentReviews.Find(id);

            db.AgentReviews.Remove(agentReview);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public IActionResult Create(AgentReview AgentReview)
 {
     if (ModelState.IsValid)
     {
         AgentReview.CreatedBy = _admin.Fullname;
         _AgentReview.CreateAgentReview(AgentReview);
         return(RedirectToAction("index"));
     }
     return(View(AgentReview));
 }
Exemplo n.º 3
0
        public IActionResult Delete(int id)
        {
            AgentReview abs = _AgentReview.GetAgentReviewById(id);

            if (abs == null)
            {
                return(NotFound());
            }
            _AgentReview.DeleteAgentReview(abs);
            return(RedirectToAction("index"));
        }
Exemplo n.º 4
0
        public IActionResult Edit(int id)
        {
            ViewBag.Agents = _AgentRepository.GetAllAgents();
            AgentReview abs = _AgentReview.GetAgentReviewById(id);

            if (abs == null)
            {
                return(NotFound());
            }
            return(View(abs));
        }
 public void UpdateAgentReview(AgentReview AgentReviewToUpdate, AgentReview model)
 {
     AgentReviewToUpdate.Status     = model.Status;
     AgentReviewToUpdate.AgentId    = model.AgentId;
     AgentReviewToUpdate.Name       = model.Name;
     AgentReviewToUpdate.Comment    = model.Comment;
     AgentReviewToUpdate.Star       = model.Star;
     AgentReviewToUpdate.ModifiedBy = model.ModifiedBy;
     AgentReviewToUpdate.ModifiedAt = DateTime.Now;
     _context.SaveChanges();
 }
        public ActionResult Create([Bind(Include = "AgentId,ReviewerId,Rating,BodyText,DateOfReview")] AgentReview agentReview)
        {
            if (ModelState.IsValid)
            {
                db.AgentReviews.Add(agentReview);
                db.SaveChanges();
                return(RedirectToAction("Profile", "Agent", new { id = agentReview.AgentId }));
            }

            return(View(agentReview));
        }
        // GET: AgentReviews/Create
        public ActionResult Create(string id)
        {
            var userId      = User.Identity.GetUserId();
            var reviewModel = new AgentReview()
            {
                AgentId      = id,
                ReviewerId   = userId,
                DateOfReview = DateTime.Now,
            };

            return(View(reviewModel));
        }
 public ActionResult Edit([Bind(Include = "Id,AgentId,ReviewerId,Rating,BodyText,DateOfReview")] AgentReview agentReview)
 {
     if (ModelState.IsValid)
     {
         db.Entry(agentReview).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ReviewerId = new SelectList(db.ReviewerAccounts, "Id", "FirstName", agentReview.ReviewerId);
     ViewBag.AgentId    = new SelectList(db.AgentAccounts, "Id", "FirstName", agentReview.AgentId);
     return(View(agentReview));
 }
        // GET: AgentReviews/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AgentReview agentReview = db.AgentReviews.Find(id);

            if (agentReview == null)
            {
                return(HttpNotFound());
            }
            return(View(agentReview));
        }
Exemplo n.º 10
0
 public IActionResult Edit(AgentReview abs)
 {
     if (ModelState.IsValid)
     {
         abs.ModifiedBy = _admin.Fullname;
         AgentReview AgentToUpdate = _AgentReview.GetAgentReviewById(abs.Id);
         if (AgentToUpdate == null)
         {
             return(NotFound());
         }
         _AgentReview.UpdateAgentReview(AgentToUpdate, abs);
         return(RedirectToAction("index"));
     }
     return(View(abs));
 }
        // GET: AgentReviews/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AgentReview agentReview = db.AgentReviews.Find(id);

            if (agentReview == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ReviewerId = new SelectList(db.ReviewerAccounts, "Id", "FirstName", agentReview.ReviewerId);
            ViewBag.AgentId    = new SelectList(db.AgentAccounts, "Id", "FirstName", agentReview.AgentId);
            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));
            }
        }
 public void DeleteAgentReview(AgentReview AgentReview)
 {
     _context.AgentReviews.Remove(AgentReview);
     _context.SaveChanges();
 }
 public void CreateAgentReview(AgentReview model)
 {
     model.CreatedAt = DateTime.Now;
     _context.AgentReviews.Add(model);
     _context.SaveChanges();
 }