This method is called in my business service from an asp.net mvc controller. Should there occur an exception or not I need to return a Result object.
The result class is experimental, maybe there is something better.
How would you do the exception handling, if I do not expect a special exception.
I just want to show the user the error message from the exception in my javascript file
with a messagebox if the success returns false.
public Result CreateTestplan(Testplan testplan)
{
using (var con = new SqlConnection(_connectionString))
using (var trans = new TransactionScope())
{
con.Open();
_testplanDataProvider.AddTestplan(testplan);
_testplanDataProvider.CreateTeststepsForTestplan(testplan.Id, testplan.TemplateId);
trans.Complete();
}
}
class Result
{
public bool Success {get;set;}
public string Error {get;set;}
}