public HttpResponseMessage Put(HttpRequestMessage request, CustomHeaderViewModel customHeaderVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var CustomHeaderDb = _customImageService.GetById(customHeaderVM.ID);
                    CustomHeaderDb.UpdateCustomHeader(customHeaderVM);
                    CustomHeaderDb.UpdateDate = DateTime.Now;
                    CustomHeaderDb.UpdateBy = User.Identity.Name;
                    _customImageService.Update(CustomHeaderDb);
                    _customImageService.Save();

                    var responseData = Mapper.Map <CustomHeader, CustomHeaderViewModel>(CustomHeaderDb);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }
                return response;
            }));
        }
        //UpdateCustomHeader
        public static void UpdateCustomHeader(this CustomHeader customHeader, CustomHeaderViewModel customHeaderViewModel)
        {
            customHeader.ID         = customHeaderViewModel.ID;
            customHeader.Type       = customHeaderViewModel.Type;
            customHeader.Color      = customHeaderViewModel.Color;
            customHeader.Content    = customHeaderViewModel.Content;
            customHeader.PaddingTop = customHeaderViewModel.PaddingTop;
            customHeader.Height     = customHeaderViewModel.Height;

            customHeader.CreatedDate = customHeaderViewModel.CreatedDate;
            customHeader.UpdateDate  = customHeaderViewModel.UpdateDate;
            customHeader.CreatedBy   = customHeaderViewModel.CreatedBy;
            customHeader.UpdateBy    = customHeaderViewModel.UpdateBy;
            customHeader.Status      = customHeaderViewModel.Status;
        }
        public HttpResponseMessage Create(HttpRequestMessage request, CustomHeaderViewModel customHeaderVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    CustomHeader newCustomHeader = new CustomHeader();
                    newCustomHeader.UpdateCustomHeader(customHeaderVM);
                    newCustomHeader.CreatedDate = DateTime.Now;
                    newCustomHeader.CreatedBy = User.Identity.Name;
                    var page = _customImageService.Add(newCustomHeader);
                    _customImageService.Save();
                    response = request.CreateResponse(HttpStatusCode.Created, page);
                }
                return response;
            }));
        }