Example #1
0
        public IActionResult CatalogAdd(CatalogModel model)
        {
            var entity = model.MapTo <CatalogModel, Catalog>();

            entity.CreateTime = DateTime.Now;
            entity.Cover      = model.Cover.Upload(_hostEnvironment.WebRootPath, "catalog");
            _context.Catalog.Add(entity);
            _context.SaveChanges();
            return(Json(true.ToResult()));
        }