title: Inserting new record from AngularJS using Web API
body: <p>Hi I'm a newbie in web development and I'm having some trouble in inserting new data in my database.</p>
  
  <p>First, there's an error in dbcontext.Tbl_Articles.Add(adto);
  It says, cannot convert WebAPI.Models.Articles to WebAPI.DataLayer.Tbl_Articles</p>
  
  <p>Another thing is, whenever I run my Web API, it says something like this - {"Message":"The requested resource does not support http method 'GET'."}
  script file:</p>
  
  <pre><code>$scope.AddArticle = function ()
  {
      var data =
          {
              Category: $scope.Category,
              IsCarousel: $scope.IsCarousel,
              IsImportant: $scope.IsImportant,
              HeaderImage: $scope.HeaderImage,
              Title: $scope.Title,
              ByLine: $scope.ByLine,
              Content: $scope.Content,
              Author: $scope.Author,
              PublishStartDate: $scope.PublishStartDate_date + " " + $scope.PublishStartDate_time + $scope.PublishStartDate_time_ext,
              PublishEndDate: $scope.PublishEndDate_date + " " + $scope.PublishEndDate_time + $scope.PublishEndDate_time_ext
          };
  
      $http(
          {
              method: 'POST',
              url: 'http://project-aphrodite-uat-service.azurewebsites.net/api/articles/createarticle',
              data: JSON.stringify(data)
          })
          .then(function successCallback(response)
          {
              console.log(response);
          },
          function errorCallback(response)
          {
              console.log("error" + response);
          });
  
  };
  </code></pre>
  
  <p>ArticlesController.cs:</p>
  
  <pre><code>    [HttpPost]
      [Route("api/articles/createarticle")]
      public Articles CreateArticle(Articles obj)
      {
          DataLayer.DataLayer dl = new DataLayer.DataLayer();
          dl.CreateArticle(obj);
          return obj;
      }
  </code></pre>
  
  <p>DataLayer.cs:</p>
  
  <pre><code>    public string CreateArticle(Articles obj)
      {
          var adto = new Articles();
          adto.Category = obj.Category;
          adto.IsCarousel = obj.IsCarousel;
          adto.IsImportant = obj.IsImportant;
          adto.HeaderImage = obj.HeaderImage;
          adto.Title = obj.Title;
          adto.ByLine = obj.ByLine;
          adto.Content = obj.Content;
          adto.Author = obj.Author;
          adto.PublishStartDate = obj.PublishStartDate;
          adto.PublishEndDate = obj.PublishEndDate;
  
          using (ArticleEntities dbcontext = new ArticleEntities())
          {
              dbcontext.Tbl_Articles.Add(adto);
              dbcontext.SaveChanges();
  
              return "test";
          }
      }
  </code></pre>
  
  <p>I hope someone could help me fix these. Thankie so much!</p>