public static void CheckAndSend() { lock (typeof(MailChecker)) // блок-ка { List<Lot> lotList = new LotRepository().GetInactiveLot(); if (lotList != null) { foreach (Lot lot in lotList) { if (lot != null) { if (lot.Customer_id != 0) { User userCustomer = new UserRepository().GetDBUser(lot.Customer_id); MailSender.SendMail(4, userCustomer, lot); User userOwner = new UserRepository().GetDBUser(lot.Owner_id); MailSender.SendMail(6, userOwner, lot); } else { User user = new UserRepository().GetDBUser(lot.Owner_id); MailSender.SendMail(7, user, lot); } // lot.DateEnd } } } } }
// GET: /Lot/Details/5 public ActionResult Details(int id) { var review = new LotRepository().GetLot(id); long ticks = review.DateEnd.Subtract(review.StartTime).Ticks; ViewBag.Ticks = review.DateEnd.Subtract(review.StartTime).TotalSeconds; if (review == null) { return RedirectToAction("Http404", "Error"); } LotEditModel newreview = new LotEditModel(review); return View(newreview); }
// // GET: /User/Delete/5 public ActionResult Delete(int id) { try { User userOwner = new UserRepository().GetDBUser(id); MailSender.SendMail(3, userOwner); var lotrep = new LotRepository().DeleteUserLots(id); _db.DeleteUser(id); } catch (Exception ex) { throw ex; } return RedirectToAction("Index"); }
public ActionResult Create(Lot newLot, IEnumerable<HttpPostedFileBase> fileUpload) { if (ModelState.IsValid) { try { LoadPicture(fileUpload, ref newLot); // TODO: Add insert logic here var user_id = new UserRepository().GetDBUser(User.Identity.Name).user_id; newLot.Owner_id = user_id; var review = new LotRepository().InsertLot(newLot); return RedirectToAction("Index", "Home"); } catch { return View(newLot); } } return View(newLot); }
public ActionResult Details(LotEditModel lot, FormCollection collection) { if (ModelState.IsValid) { var review = new LotRepository().GetLot(lot.Id); var oldCustomer = new UserRepository().GetDBUser(review.Customer_id); if (review.Customer_id != 0) { MailSender.SendMail(5, oldCustomer, review); } var customer = new UserRepository().GetDBUser(User.Identity.Name); if (oldCustomer.user_id != customer.user_id) { lotrep.SetPrice(lot.Id, lot.Price, customer.user_id); } else { lotrep.SetPrice(lot.Id, lot.Price); } ViewBag.PriceValid = "You rate has been accepted"; } var lotEdit = new LotRepository().GetLot(lot.Id); LotEditModel newreview = new LotEditModel(lotEdit); return View(newreview); }
// GET: /Lot/ public ActionResult Index() { var review = new LotRepository().GetAllLots(); return PartialView(review); }
public ActionResult Edit(Lot review, IEnumerable<HttpPostedFileBase> fileUpload) { if (TryUpdateModel(review)) { LoadPicture(fileUpload, ref review); LotRepository lotrep = new LotRepository(); lotrep.UpdateLot(review); return RedirectToAction("Index", "Home"); } else return View(review); }
public ActionResult Edit(int id) { var review = new LotRepository().GetLot(id); if (review == null) { return RedirectToAction("Http404", "Error"); } int timerTime = review.DateEnd.Subtract(review.StartTime).Milliseconds; return View(review); }