public async Task <IActionResult> Edit(int id, [Bind("Id,OrderNumber,TextContent,TailX,TailY,TextClass,PanelId")] PanelText panelText) { if (id != panelText.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(panelText); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PanelTextExists(panelText.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PanelId"] = new SelectList(_context.Panels, "Id", "Id", panelText.PanelId); return(View(panelText)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,TitleId")] Issue issue) { if (id != issue.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(issue); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IssueExists(issue.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TitleId"] = new SelectList(_context.Titles, "Id", "Id", issue.TitleId); return(View(issue)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Title title, IFormFile titleImage) { if (id != title.Id) { return(NotFound()); } if (ModelState.IsValid) { try { if (titleImage != null) { string mimeType = titleImage.ContentType; long fileLength = titleImage.Length; if (!(mimeType == "" || fileLength == 0)) { using (var memoryStream = new MemoryStream()) { await titleImage.CopyToAsync(memoryStream); title.TitleImageContent = ResizeImage.shrinkImagePNG(memoryStream.ToArray(), 150, 150); } title.TitleImageMimeType = mimeType; title.TitleImageFileName = titleImage.FileName; } } _context.Update(title); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TitleExists(title.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(title)); }