public static DbEmdSectionViewModel CreateViewModel(this DbEmdSection dbObject)
 {
     DbEmdSectionViewModel retVal = new DbEmdSectionViewModel();
     retVal.ID = dbObject.ID;
     retVal.Index = dbObject.Index;
     retVal.Position = dbObject.Position;
     retVal.IsSelected = dbObject.IsSelected;
     return retVal;
 }
 public HttpResponseMessage PostSection(DbEmdSectionViewModel section)
 {
     if (section == null)
     {
         return Request.CreateErrorResponse(HttpStatusCode.BadRequest,
         new HttpError
         {
             Message = "Invalid input - input is null",
         });
     }
     var query = m_repoSection.SelectByID(section.ID);
     if (query == null)
     {
         return Request.CreateErrorResponse(HttpStatusCode.BadRequest,
         new HttpError
         {
             Message = "No such data item",
             MessageDetail = string.Format("No item with ID {0} was found", section.ID)
         });
     }
     query.UpdateDb(section);
     m_repoSection.SaveChanges();
     return Request.CreateResponse(HttpStatusCode.OK);
 }
 public static void UpdateDb(this DbEmdSection dbObject, DbEmdSectionViewModel viewModel)
 {
     dbObject.IsSelected = viewModel.IsSelected;
 }