how to make edit to row from table using linq

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
ahmedsa
Posts: 10
Joined: Mon 15 Aug 2016 10:17

how to make edit to row from table using linq

Post by ahmedsa » Mon 15 Aug 2016 10:46

In my Relation i have two tables relation (one to many)

table country

Id (primary key)

Countryname

table City

Id (primary key)

Cityname

Countryid (forign key)

I have controller City have list of data in city table as following



using System;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using LinqProject.Models;
namespace LinqProject.Controllers
{
public class CityController : Controller
{
mytaskdbEntities db = new mytaskdbEntities();

// GET: City
public ActionResult List()
{
return View(db.Cities.ToList());
}
and in view of List as following
<body>
<div>
<table>
@foreach (var item in Model)
{
<tr><td>@item.Cityname</td><td>@item.Country.Countryname</td></tr>
}
</table>
</div>
</body>
What i need actually adding EDIT button to view of list of city

and i can edit row city when click edit button

how to do edit record by linq

the final result as following

USA NEWYORK EDITBUTTON

USA WASHINTON EDITBUTTON

FRANCE PARIS EDITEBUTTON

when click EDIT button for row USA NEWYORK and change it to NEWGERSY it will edit

and records will be after edited as following

USA NEWGERSY EDITBUTTON

USA WASHINTON EDITBUTTON

FRANCE PARIS EDITEBUTTON

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: how to make edit to row from table using linq

Post by Shalex » Wed 17 Aug 2016 17:41

We have reproduced the issue with missing Edit link on the page generated by the MVC View Advanced template. We will notify you when it is fixed.

Post Reply