Exemplo n.º 1
0
 public IActionResult Create(PropertyReview PropertyReview)
 {
     if (ModelState.IsValid)
     {
         PropertyReview.CreatedBy = _admin.Fullname;
         _PropertyReview.CreatePropertyReview(PropertyReview);
         return(RedirectToAction("index"));
     }
     return(View(PropertyReview));
 }
Exemplo n.º 2
0
        public IActionResult Delete(int id)
        {
            PropertyReview abs = _PropertyReview.GetPropertyReviewById(id);

            if (abs == null)
            {
                return(NotFound());
            }
            _PropertyReview.DeletePropertyReview(abs);
            return(RedirectToAction("index"));
        }
Exemplo n.º 3
0
        public IActionResult Edit(int id)
        {
            ViewBag.Properties = _PropertyRepository.GetAllProperties();
            PropertyReview abs = _PropertyReview.GetPropertyReviewById(id);

            if (abs == null)
            {
                return(NotFound());
            }
            return(View(abs));
        }
 public void UpdatePropertyReview(PropertyReview PropertyReviewToUpdate, PropertyReview model)
 {
     PropertyReviewToUpdate.Status     = model.Status;
     PropertyReviewToUpdate.PropertyId = model.PropertyId;
     PropertyReviewToUpdate.Name       = model.Name;
     PropertyReviewToUpdate.Comment    = model.Comment;
     PropertyReviewToUpdate.Star       = model.Star;
     PropertyReviewToUpdate.ModifiedBy = model.ModifiedBy;
     PropertyReviewToUpdate.ModifiedAt = DateTime.Now;
     _context.SaveChanges();
 }
Exemplo n.º 5
0
 public IActionResult Edit(PropertyReview abs)
 {
     if (ModelState.IsValid)
     {
         abs.ModifiedBy = _admin.Fullname;
         PropertyReview PropertyToUpdate = _PropertyReview.GetPropertyReviewById(abs.Id);
         if (PropertyToUpdate == null)
         {
             return(NotFound());
         }
         _PropertyReview.UpdatePropertyReview(PropertyToUpdate, abs);
         return(RedirectToAction("index"));
     }
     return(View(abs));
 }
Exemplo n.º 6
0
        public IActionResult SingleProduct(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
            {
                PropertyReview model = new PropertyReview
                {
                    CreatedBy  = catgory.CreatedBy,
                    Status     = true,
                    Star       = (byte)catgory.Id,
                    Name       = catgory.CreatedBy,
                    Comment    = catgory.Name,
                    PropertyId = Int32.Parse(catgory.ModifiedBy)
                };
                var routevaule = new
                {
                    id      = catgory.catId,
                    agentId = catgory.othrId,
                    propId  = Int32.Parse(catgory.ModifiedBy)
                };

                if (ModelState.IsValid)
                {
                    _propertyReviewRepository.CreatePropertyReview(model);
                    return(RedirectToAction("singleproduct", "property", routevaule));
                }
                return(RedirectToAction("singleproduct", "property", routevaule));
            }
        }
 public void DeletePropertyReview(PropertyReview PropertyReview)
 {
     _context.PropertyReviews.Remove(PropertyReview);
     _context.SaveChanges();
 }
 public void CreatePropertyReview(PropertyReview model)
 {
     model.CreatedAt = DateTime.Now;
     _context.PropertyReviews.Add(model);
     _context.SaveChanges();
 }