tag:blogger.com,1999:blog-6082652835152798567.post4184215884173043320..comments2024-03-28T21:41:58.974-07:00Comments on Sql server, .net and c# video tutorial: Part 18 - Updating data in mvcUnknownnoreply@blogger.comBlogger9125tag:blogger.com,1999:blog-6082652835152798567.post-23679777495749343102020-07-14T12:07:57.145-07:002020-07-14T12:07:57.145-07:00When I am updating department id it is showing Una...When I am updating department id it is showing Unable to cast object of type 'System.Int32' to type 'System.String'.Satyabrata Sahoohttps://www.blogger.com/profile/15977650230185174524noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-1495245391521903132019-10-18T02:54:10.580-07:002019-10-18T02:54:10.580-07:00Dude its working in VS2019...!!!!Dude its working in VS2019...!!!!Yogeshwar Goswamihttps://www.blogger.com/profile/02202102626186521625noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-22876946210907431782017-10-12T05:08:02.638-07:002017-10-12T05:08:02.638-07:00[HttpGet]
public ActionResult Edit(int id)... [HttpGet]<br /> public ActionResult Edit(int id)<br /> { <br /> EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer(); <br /> Employee employee = employeeBusinessLayer.Employees.Single(emp => emp.ID == id); <br /> <br /> return View(employee);<br /> }Anonymoushttps://www.blogger.com/profile/01253178792809174297noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-57280788593030041822016-05-30T19:11:18.360-07:002016-05-30T19:11:18.360-07:00why we use library class in mvc project
and my sec...why we use library class in mvc project<br />and my second question why we add reference Moving Shiftinghttps://www.blogger.com/profile/01838866881493516089noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-21699849281820418682015-10-29T00:55:57.643-07:002015-10-29T00:55:57.643-07:00It's important to return employee object. for ...It's important to return employee object. for example if you have a field with displayFor in Edit View. If you do Postback, the field will be empty because you did not return employee to the View.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-32951917386559519662015-04-01T02:32:58.420-07:002015-04-01T02:32:58.420-07:00[HttpPost]
public ActionResult Edit(Employee emplo...[HttpPost]<br />public ActionResult Edit(Employee employee)<br />{<br /> if (ModelState.IsValid)<br /> {<br /> EmployeeBusinessLayer employeeBusinessLayer =<br /> new EmployeeBusinessLayer();<br /> employeeBusinessLayer.SaveEmmployee(employee);<br /><br /> return RedirectToAction("Index");<br /> }<br /> return View(employee);<br />}<br />Note that in he post method we are validating the input. if its valid we are posting the data else we are returning the user to the current view which takes employee as the parameterNizamnoreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-83919622301955088532014-11-07T20:23:33.973-08:002014-11-07T20:23:33.973-08:00Typo in SaveEmmployee - code still works if you ha...Typo in SaveEmmployee - code still works if you have use employeeBusinessLayer.SaveEmmployee.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-85722020042384765082014-05-04T03:14:06.152-07:002014-05-04T03:14:06.152-07:00who maintain the asp.net worker procsserwho maintain the asp.net worker procsserSrinivashttps://www.blogger.com/profile/09148545351916544950noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-53736416770650411432013-07-19T05:13:04.636-07:002013-07-19T05:13:04.636-07:00Here i want to clarify that in last edit function ... Here i want to clarify that in last edit function we need not to pass employee object<br /><br /> return RedirectToAction("Index");<br /> }<br /> return View(employee);<= not necessary to pass employee <br />}<br />Mahesh Bishthttps://www.blogger.com/profile/09594301445235278272noreply@blogger.com