Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,CompanyName,Telephone,JobName,JobCategoryId,SubCategoryId,JobLocation,Salary,Description,Summary")] Jobs jobs)
        {
            if (id != jobs.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobsExists(jobs.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["JobCategoryId"] = new SelectList(_context.Category, "Id", "Name", jobs.JobCategoryId);
            ViewData["JobLocation"]   = new SelectList(_context.Set <JobLocation>(), "Id", "CityName", jobs.JobLocation);
            ViewData["SubCategoryId"] = new SelectList(_context.SubCategory, "Id", "Name", jobs.SubCategoryId);
            return(View(jobs));
        }
Esempio n. 2
0
        public IActionResult Editar(Comment comment)
        {
            _context.Update(comment);
            _context.SaveChanges();

            return(RedirectToAction("Details", "Post", new { id = comment.PostId }));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, JobCategory category)
        {
            if (id != category.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryExists(category.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(category));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Content,CreateTime,ImageUrl")] Blogposts blogposts)
        {
            if (id != blogposts.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(blogposts);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BlogpostsExists(blogposts.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(blogposts));
        }
Esempio n. 5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Username,Password,StreetAdress,PostNumber,City,Country,Email,Currency,CreatedAt,PhoneNumber")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Esempio n. 6
0
        public IActionResult Editar(Post post)
        {
            _context.Update(post);
            _context.SaveChanges();

            return(RedirectToAction("Index"));
        }