예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,UserName,Proffesion,Project,Rating,completeDate")] History history)
        {
            if (id != history.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(history);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HistoryExists(history.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(history));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ProjectTitle,Description,Skills,Price,DueDate,ContactEmail")] Work work)
        {
            if (id != work.ID)
            {
                return(NotFound());
            }

            FreeLancers4User user = await _userManager.GetUserAsync(User);

            if (!work.Owner.Equals(user))
            {
                return(NotFound());
            }

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

            return(View(work));
        }