public async Task <IActionResult> Edit(int id, [Bind("Id,Type,Title,Percentage")] Skills skills) { if (id != skills.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(skills); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SkillsExists(skills.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(skills)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Content,FileName")] Card card) { if (id != card.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(card); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CardExists(card.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(card)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,PicAddress,About,Link")] Articles articles) { if (id != articles.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(articles); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArticlesExists(articles.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(articles)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Explain1,Explain2")] Educations educations) { if (id != educations.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(educations); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EducationsExists(educations.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(educations)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Family,Email,UserName,PassWord")] Users users) { if (id != users.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(users); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsersExists(users.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(users)); }
public IActionResult Put(int id, [FromBody] Card card) { if (id != card.id) { return(BadRequest("Id's nao coincidem")); } _context.Update(card); _context.SaveChanges(); return(Ok(card)); }
public async Task <ActionResult <Card> > Put(Card card) { if (card == null) { return(BadRequest()); } if (!db.Cards.Any(x => x.Id == card.Id)) { return(NotFound()); } db.Update(card); await db.SaveChangesAsync(); return(Ok(card)); }
public int AddComment(Comment comment) { if (comment == null) { throw new Exception("AddComment method error: comment is null"); } _db.Comments.Add(comment); _db.SaveChanges(); if (comment.CardId != null) { var card = _dbCards.Cards.Find(comment.CardId); card.AddCommentId(comment.Id); _dbCards.Update(card); _dbCards.SaveChanges(); } return(comment.Id); }