Skip to content

Instantly share code, notes, and snippets.

@detroitpro
Created October 28, 2011 21:08
Show Gist options
  • Save detroitpro/1323568 to your computer and use it in GitHub Desktop.
Save detroitpro/1323568 to your computer and use it in GitHub Desktop.
Sample Action
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
namespace Application
{
public class Sample : Controller
{
public Sample(ISampleService sampleService){
_sampleService = sampleService;
}
public ActionResult Details(int Id){
var vm = new SampleDetailsViewModel();
var complexResult = _sampleService.DoSomethingGreaterThanDataAccess(Id);
if(complexResult.Success){
vm = Mapper.Map<ComplexResultType, SampleDetailsViewModel>(complexResult);
}
return View(vm);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment