コード例 #1
0
        // ------------------------- CREATE -------------------------------------
        // GET
        public ActionResult Create()
        {
            OgloszenieEditViewModel ogloszenie = new OgloszenieEditViewModel();

            ogloszenie.Miasta       = _miastoRepo.GetCities();
            ogloszenie.RodzajeUmowy = _repo.GetAgreementTypes();
            ogloszenie.Kategorie    = _kategoriaRepo.GetCategories();
            if (ogloszenie == null)
            {
                return(HttpNotFound());
            }
            else if (ogloszenie.UzytkownikId != User.Identity.GetUserId() && !(User.IsInRole("Admin") || User.IsInRole("Pracownik")))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            return(View(ogloszenie));
        }