Skip to content

Commit 072abb4

Browse files
16th commit
Fetching data
1 parent 6575d5d commit 072abb4

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

MvcCV/Controllers/ExperiencesController.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,20 @@ public ActionResult DeleteExperience(int id)
3939
db.SaveChanges();
4040
return RedirectToAction("Index");
4141
}
42+
public ActionResult BringExperience(int id)
43+
{
44+
var data = db.TBLEXPERIENCE.Find(id);
45+
return View("BringExperience", data);
46+
}
47+
public ActionResult UpdateExperience(TBLEXPERIENCE p)
48+
{
49+
var datas = db.TBLEXPERIENCE.Find(p.ID);
50+
datas.TITLE = p.TITLE;
51+
datas.SUBTITLE = p.SUBTITLE;
52+
datas.DETAILS = p.DETAILS;
53+
datas.DATE = p.DATE;
54+
db.SaveChanges();
55+
return RedirectToAction("Index");
56+
}
4257
}
4358
}

MvcCV/MvcCV.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@
321321
<Content Include="Views\Interests\NewInterest.cshtml" />
322322
<Content Include="Views\Certificates\NewCertificate.cshtml" />
323323
<Content Include="Views\About\BringData.cshtml" />
324+
<Content Include="Views\Experiences\BringExperience.cshtml" />
324325
</ItemGroup>
325326
<ItemGroup>
326327
<Folder Include="App_Data\" />
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@model MvcCV.Models.Entity.TBLEXPERIENCE
2+
@{
3+
ViewBag.Title = "BringExperience";
4+
Layout = "~/Views/Shared/_MainLayout.cshtml";
5+
}
6+
7+
@using(Html.BeginForm("UpdateExperience", "Experiences", FormMethod.Post))
8+
{
9+
<div class="form-group">
10+
@Html.LabelFor(m => m.ID)
11+
@Html.TextBoxFor(m => m.ID, new { @class = "form-control" })
12+
<br />
13+
@Html.LabelFor(m => m.TITLE)
14+
@Html.TextBoxFor(m => m.TITLE, new { @class = "form-control" })
15+
<br />
16+
@Html.LabelFor(m => m.SUBTITLE)
17+
@Html.TextBoxFor(m => m.SUBTITLE, new { @class = "form-control" })
18+
<br />
19+
@Html.LabelFor(m => m.DATE)
20+
@Html.TextBoxFor(m => m.DATE, new { @class = "form-control" })
21+
<br />
22+
@Html.LabelFor(m => m.DETAILS)
23+
@Html.TextAreaFor(m => m.DETAILS, new { @class = "form-control" })
24+
<br />
25+
<button class="btn btn-primary">Update</button>
26+
</div>
27+
}
28+

MvcCV/Views/Experiences/Index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<td>@x.DATE</td>
2727
<td>@x.DETAILS</td>
2828
<td><a href="/Experiences/DeleteExperience/@x.ID" class="btn btn-danger">Delete</a></td>
29-
<td><a href="#" class="btn btn-success">Update</a></td>
29+
<td><a href="/Experiences/BringExperience/@x.ID" class="btn btn-success">Update</a></td>
3030
</tr>
3131
}
3232
</tbody>

0 commit comments

Comments
 (0)