Exemple #1
0
        public IActionResult Edit(int id)
        {
            var repo = new JobOffersRepository();
            var item = repo.GetById(id);

            if (item == null)
            {
                return(View(new JobOfferEditVM()));
            }

            var editVM = new JobOfferEditVM()
            {
                ID          = item.ID,
                CreatorId   = item.ID,
                Title       = item.Title,
                Description = item.Description
            };

            return(View(editVM));
        }
Exemple #2
0
        public IActionResult Edit(JobOfferEditVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var repo = new JobOffersRepository();
            var item = repo.GetById(model.ID);

            if (item == null)
            {
                item           = new Models.JobOffer();
                item.CreatorId = AuthService.LoggedUser.ID;
            }

            item.Title       = model.Title;
            item.Description = model.Description;
            repo.Save(item);

            return(RedirectToAction("List"));
        }