public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Age,Gender,Sexuality,ImageFilepath,Presentation,IsActive")] ProfileModel profileModel)
        {
            if (id != profileModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(profileModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfileModelExists(profileModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(profileModel));
        }
Esempio n. 2
0
        //update a data
        public async Task <Values> UpdateValue(Values value)
        {
            try
            {
                _context.Update(value);
                await _context.SaveChangesAsync();

                return(value);
            }catch (Exception e)
            {
                return(value);
            }
        }