Skip to content

Commit f8b5990

Browse files
17th commit
Updating skills
1 parent 855ccc0 commit f8b5990

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

MvcCV/Controllers/SkillsController.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,18 @@ public ActionResult DeleteSkill(int id)
3737
db.SaveChanges();
3838
return RedirectToAction("Index");
3939
}
40+
public ActionResult BringSkill(int id)
41+
{
42+
var skill = db.TBLSKILLS.Find(id);
43+
return View("BringSkill", skill);
44+
}
45+
public ActionResult UpdateSkill(TBLSKILLS p)
46+
{
47+
var data = db.TBLSKILLS.Find(p.ID);
48+
data.SKILL = p.SKILL;
49+
db.SaveChanges();
50+
return RedirectToAction("Index");
51+
52+
}
4053
}
4154
}

MvcCV/MvcCV.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@
323323
<Content Include="Views\About\BringData.cshtml" />
324324
<Content Include="Views\Experiences\BringExperience.cshtml" />
325325
<Content Include="Views\Education\BringEducation.cshtml" />
326+
<Content Include="Views\Skills\BringSkill.cshtml" />
326327
</ItemGroup>
327328
<ItemGroup>
328329
<Folder Include="App_Data\" />
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@model MvcCV.Models.Entity.TBLSKILLS
2+
@{
3+
ViewBag.Title = "BringSkill";
4+
Layout = "~/Views/Shared/_MainLayout.cshtml";
5+
}
6+
7+
@using (Html.BeginForm("UpdateSkill", "Skills", 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.SKILL)
14+
@Html.TextBoxFor(m => m.SKILL, new { @class = "form-control" })
15+
<br />
16+
<button class="btn btn-primary">Update</button>
17+
</div>
18+
}

MvcCV/Views/Skills/Index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<th>@x.ID</th>
2323
<td>@x.SKILL</td>
2424
<td><a href="/Skills/DeleteSkill/@x.ID" class="btn btn-danger">Delete</a></td>
25-
<td><a href="/skills/UpdateSkill/@x.ID" class="btn btn-success">Update</a></td>
25+
<td><a href="/Skills/BringSkill/@x.ID" class="btn btn-success">Update</a></td>
2626
<td>@Html.ActionLink("Delete Button", "DeleteSkill", new { id=x.ID}, new { @class="btn btn-warning",onclick="return confirm('Do you want to delete now?')"})</td>
2727
</tr>
2828
}

0 commit comments

Comments
 (0)