public ActionResult Odpowiedz(WizytyDisplayViewModel model) { if (model.IdWizyty == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Wizyty wiz = db.Wizyty.Include("Apartament").ToList().First(w => w.IdWizyty == model.IdWizyty); if (wiz == null) { return(HttpNotFound()); } if (wiz.Apartament.IdWlasciciel != User.Identity.GetUserId()) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } wiz.Odpowiedz = model.Odpowiedz; wiz.DataOdpowiedz = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Details", "Apartamenty")); }
public ActionResult Komentarz(WizytyDisplayViewModel model) { if (model.IdWizyty == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Wizyty wiz = db.Wizyty.Include("Apartament").ToList().First(w => w.IdWizyty == model.IdWizyty); if (wiz == null) { return(HttpNotFound()); } if (wiz.IdKlient != User.Identity.GetUserId()) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } wiz.Komentarz = model.Komentarz; wiz.DataKomentarz = DateTime.Now; wiz.Ocena = model.Ocena; db.SaveChanges(); return(RedirectToAction("MojeWizyty")); }
public ActionResult Komentarz(int Id) { if (Id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Wizyty wiz = db.Wizyty.Include("Apartament").ToList().First(w => w.IdWizyty == Id); if (wiz == null) { return(HttpNotFound()); } if (wiz.IdKlient != User.Identity.GetUserId()) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } WizytyDisplayViewModel rez = new WizytyDisplayViewModel(wiz); ViewData["OcenaList"] = new List <SelectListItem>() { new SelectListItem() { Value = "5", Text = "5" }, new SelectListItem() { Value = "4", Text = "4" }, new SelectListItem() { Value = "3", Text = "3" }, new SelectListItem() { Value = "2", Text = "2" }, new SelectListItem() { Value = "1", Text = "1" }, }; return(PartialView("_Komentarz", rez)); }
public ActionResult Odpowiedz(int Id) { if (Id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Wizyty wiz = db.Wizyty.Include("Apartament").ToList().First(w => w.IdWizyty == Id); if (wiz == null) { return(HttpNotFound()); } if (wiz.Apartament.IdWlasciciel != User.Identity.GetUserId()) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } WizytyDisplayViewModel rez = new WizytyDisplayViewModel(wiz); return(PartialView("_Odpowiedz", rez)); }
public ActionResult Odrzuc(int?Id) { if (Id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Wizyty wiz = db.Wizyty.Include("Apartament").ToList().First(w => w.IdWizyty == Id); if (wiz == null) { return(HttpNotFound()); } if (wiz.Apartament.IdWlasciciel != User.Identity.GetUserId()) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } wiz.Potwierdzona = false; db.SaveChanges(); return(RedirectToAction("MojeApartamentyWizyty")); }