Using AutoMapper in ASP.Net MVC I'd like to check my understanding and usage of the AutoMapper in my ASP.Net MVC app.

I setup the maps in Application_Start:

 Mapper.CreateMap&lt;Customer, CustomerViewModel&gt;();
 Mapper.CreateMap&lt;CustomerViewModel, Customer&gt;();
 Mapper.AssertConfigurationIsValid();


To return a list of users associated with the logged in user, in my Customer Controller I have:

    //
    // GET: /Customer/

    public ActionResult Index()
    {
        var customer = db.Customers.Where(x =&gt; x.UserName == User.Identity.Name).ToList();
        IList&lt;CustomerViewModel&gt; customerVM = Mapper.Map&lt;IList&lt;Customer&gt;, IList&lt;CustomerViewModel&gt;&gt;(customer);
        return View(customerVM);
    }


To Edit a specific customers details I am using:

    //
    // GET: /Customer/EditPartial
    public ActionResult EditPartial(int id)
    {
        var customer = db.Customers.Where(x =&gt; x.UserName == User.Identity.Name &amp;&amp; x.CustomerId == id).FirstOrDefault();
        CustomerViewModel customerVM = Mapper.Map&lt;Customer, CustomerViewModel&gt;(customer);
        return PartialView(customerVM);
    }


Where I Post back updates after making changes in the EditPartial view:

    //
    // POST: /Customer/EditPartial
    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult EditPartial(CustomerViewModel customerVM)
    {
        if (ModelState.IsValid)
        {
            Customer customer = db.Customers.Where(x =&gt; x.UserName == User.Identity.Name &amp;&amp; x.CustomerId == customerVM.CustomerId).FirstOrDefault();
            if (customer == null)
            {
                return HttpNotFound();
            }
            customer.CustomerName = customerVM.CustomerName;

            // How do I use AutoMapper here, instead of updating the domain model directly
            customer.Email = customerVM.Email;
            db.Entry(customer).State = EntityState.Modified;
            db.SaveChanges();
            /////////////////

            // Now I want to return a customer list again
            // Is this the best way to do it again
            var customer2 = db.Customers.Where(x =&gt; x.UserName == User.Identity.Name).ToList();
            IList&lt;CustomerViewModel&gt; customerVM2 = Mapper.Map&lt;IList&lt;Customer&gt;, IList&lt;CustomerViewModel&gt;&gt;(customer2);

            return PartialView("CustomerListPartial", customerVM2);
        }
        this.Response.StatusCode = 400;
        return PartialView("EditPartial", customerVM);
    }


The code above works, I'm just not sure about using AutoMapper in the Post, and if my way of returning a partial list of customers is the best method.
If you were not using AutoMapper, your POST method would either have a block of manual mapping, or it would call out to a custom mapper class. In the latter case, you would have a line (or two) calling that helper class instead of a line calling AutoMapper.

Whether returning a PartialView is the best method depends on your UI; if that's what your View needs, then that's what you need to to. (I personally don't use them in my markup.)

I wager the reason you think the mapping doesn't belong in your POST method is because your Controller is not just concerned with Control, but also Persistence and Construction. If the rest of your application is indeed this simple, then you might as well stick with it, but as complexity grows, you should consider hiding the persistence concerns behind an interface.