func Create(c *gin.Context) {
	db := c.MustGet("db").(*mgo.Database)

	article := models.Article{}
	err := c.Bind(&article)
	if err != nil {
		c.Error(err)
		return
	}

	err = db.C(models.CollectionArticle).Insert(article)
	if err != nil {
		c.Error(err)
	}
	c.Redirect(http.StatusMovedPermanently, "/articles")
}
func Create(c *gin.Context) {
	db := c.MustGet("db").(*mgo.Database)

	article := models.Article{}
	err := c.Bind(&article)
	if err != nil {
		c.Error(err)
		return
	}

	err = db.C(models.CollectionArticle).Insert(article)
	if err != nil {
		c.Error(err)
	}
	c.Redirect(http.StatusMovedPermanently, "/articles")
}
func Create ( c * gin . Context ) { db := c . MustGet ( " " ) . ( * mgo . Database ) article := models . Article { } err := c . Bind ( & article ) if err != nil { c . Error ( err ) return } err = db . C ( models . CollectionArticle ) . Insert ( article ) if err != nil { c . Error ( err ) } c . Redirect ( http . StatusMovedPermanently , " " ) }
// Create an article
Create an article