Skip to content

Commit 855ccc0

Browse files
16th commit
Updating education part
1 parent 072abb4 commit 855ccc0

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

MvcCV/Controllers/EducationController.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,21 @@ public ActionResult DeleteEducation(int id)
3838
db.SaveChanges();
3939
return RedirectToAction("Index");
4040
}
41+
public ActionResult BringEducation(int id)
42+
{
43+
var education = db.TBLEDUCATION.Find(id);
44+
return View("BringEducation", education);
45+
}
46+
public ActionResult UpdateEducation(TBLEDUCATION p)
47+
{
48+
var data = db.TBLEDUCATION.Find(p.ID);
49+
data.TITLE = p.TITLE;
50+
data.SUBTITLE = p.SUBTITLE;
51+
data.DEPARTMENT = p.DEPARTMENT;
52+
data.GPA = p.GPA;
53+
db.SaveChanges();
54+
return RedirectToAction("Index");
55+
56+
}
4157
}
4258
}

MvcCV/MvcCV.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
<Content Include="Views\Certificates\NewCertificate.cshtml" />
323323
<Content Include="Views\About\BringData.cshtml" />
324324
<Content Include="Views\Experiences\BringExperience.cshtml" />
325+
<Content Include="Views\Education\BringEducation.cshtml" />
325326
</ItemGroup>
326327
<ItemGroup>
327328
<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.TBLEDUCATION
2+
@{
3+
ViewBag.Title = "BringEducation";
4+
Layout = "~/Views/Shared/_MainLayout.cshtml";
5+
}
6+
7+
@using (Html.BeginForm("UpdateEducation", "Education", 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.DEPARTMENT)
20+
@Html.TextBoxFor(m => m.DEPARTMENT, new { @class = "form-control" })
21+
<br />
22+
@Html.LabelFor(m => m.GPA)
23+
@Html.TextBoxFor(m => m.GPA, new { @class = "form-control" })
24+
<br />
25+
<button class="btn btn-primary">Update</button>
26+
</div>
27+
28+
}

MvcCV/Views/Education/Index.cshtml

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

0 commit comments

Comments
 (0)