Solved

(int? id, bool? saveChangesError=false

Posted on 2014-02-20
4
466 Views
Last Modified: 2014-02-21
Could someone tell me what this line of code mean


int? id, bool? saveChangesError=false



public ActionResult Delete(int? id, bool? saveChangesError=false)
{
    if (id == null)
    {
        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
    }
    if (saveChangesError.GetValueOrDefault())
    {
        ViewBag.ErrorMessage = "Delete failed. Try again, and if the problem persists see your system administrator.";
    }
    Student student = db.Students.Find(id);
    if (student == null)
    {
        return HttpNotFound();
    }
    return View(student);
}
0
Comment
Question by:yguyon28
  • 2
4 Comments
 

Author Comment

by:yguyon28
ID: 39875784
Does (int? id mean its nulable....
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 39875792
Yes int? means id is nullable
0
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 250 total points
ID: 39875794
Here's some info on nullable types :

http://msdn.microsoft.com/en-us/library/2cf62fcy.aspx
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 250 total points
ID: 39876201
It is specifying that id is a Nullable<int> and saveChanges is a Nullable<bool> with a default value of false.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question