public IActionResult SingleAgency(Category catgory)
        {
            if (catgory.Id == 9999)
            {
                if (ModelState.IsValid)
                {
                    if (catgory.othrId < 1)
                    {
                        return(NotFound());
                    }
                    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
                {
                    return(NotFound());
                }
            }
            else
            {
                AgencyReview model = new AgencyReview
                {
                    CreatedBy = catgory.CreatedBy,
                    Status    = true,
                    Star      = (byte)catgory.Id,
                    Name      = catgory.CreatedBy,
                    Comment   = catgory.Name,
                    AgencyId  = Int32.Parse(catgory.ModifiedBy)
                };
                var routevaule = new
                {
                    id       = catgory.catId,
                    agencyId = Int32.Parse(catgory.ModifiedBy)
                };

                if (ModelState.IsValid)
                {
                    _agencyReviewRepository.CreateAgencyReview(model);
                    return(RedirectToAction("singleagency", "agency", routevaule));
                }
                return(RedirectToAction("singleagency", "agency", routevaule));
            }
        }
Ejemplo n.º 2
0
 public IActionResult Create(AgencyReview AgencyReview)
 {
     if (ModelState.IsValid)
     {
         AgencyReview.CreatedBy = _admin.Fullname;
         _agencyReview.CreateAgencyReview(AgencyReview);
         return(RedirectToAction("index"));
     }
     return(View(AgencyReview));
 }
Ejemplo n.º 3
0
        public IActionResult Delete(int id)
        {
            AgencyReview abs = _agencyReview.GetAgencyReviewById(id);

            if (abs == null)
            {
                return(NotFound());
            }
            _agencyReview.DeleteAgencyReview(abs);
            return(RedirectToAction("index"));
        }
Ejemplo n.º 4
0
        public IActionResult Edit(int id)
        {
            ViewBag.Agencies = _AgencyRepository.GetAllAgencies();
            AgencyReview abs = _agencyReview.GetAgencyReviewById(id);

            if (abs == null)
            {
                return(NotFound());
            }
            return(View(abs));
        }
Ejemplo n.º 5
0
 public void UpdateAgencyReview(AgencyReview AgencyReviewToUpdate, AgencyReview model)
 {
     AgencyReviewToUpdate.Status     = model.Status;
     AgencyReviewToUpdate.AgencyId   = model.AgencyId;
     AgencyReviewToUpdate.Name       = model.Name;
     AgencyReviewToUpdate.Comment    = model.Comment;
     AgencyReviewToUpdate.Star       = model.Star;
     AgencyReviewToUpdate.ModifiedBy = model.ModifiedBy;
     AgencyReviewToUpdate.ModifiedAt = DateTime.Now;
     _context.SaveChanges();
 }
Ejemplo n.º 6
0
 public IActionResult Edit(AgencyReview abs)
 {
     if (ModelState.IsValid)
     {
         abs.ModifiedBy = _admin.Fullname;
         AgencyReview AgencyToUpdate = _agencyReview.GetAgencyReviewById(abs.Id);
         if (AgencyToUpdate == null)
         {
             return(NotFound());
         }
         _agencyReview.UpdateAgencyReview(AgencyToUpdate, abs);
         return(RedirectToAction("index"));
     }
     return(View(abs));
 }
Ejemplo n.º 7
0
 public void DeleteAgencyReview(AgencyReview AgencyReview)
 {
     _context.AgencyReviews.Remove(AgencyReview);
     _context.SaveChanges();
 }
Ejemplo n.º 8
0
 public void CreateAgencyReview(AgencyReview model)
 {
     model.CreatedAt = DateTime.Now;
     _context.AgencyReviews.Add(model);
     _context.SaveChanges();
 }