示例#1
0
 public void CreateArtwork()
 {
     _artwork.Title       = "Unit Testing";
     _artwork.Description = "N/A";
     _artwork.Price       = 1000;
     _artwork.SizeHeight  = 25;
     _artwork.SizeWidth   = 25;
     _artwork.Date        = Convert.ToDateTime("2013-11-05 00:00:00");
     _artwork.ImgFileName = "none.png";
     _artwork.Artist      = _artistRepository.GetArtistById(_artistRepository.GetArtistByFullName("Unit Test").Id);
     _artwork.Category    = _categoryRepository.GetCategoryById(_categoryRepository.GetCategoryByTitle("Unit Test").Id);
     _artwork.Active      = true;
     _artworkRepository.InsertArtwork(_artwork);
 }
示例#2
0
        public ActionResult CreateArtwork(ArtworkViewModel model)
        {
            if (ModelState.IsValid)
            {
                var     repo    = new ArtworkRepository();
                Artwork artwork = model.ConvertToBusinessModel();
                artwork.Active = true;
                artwork.Date   = DateTime.Now;
                repo.InsertArtwork(artwork);
            }
            model.Artists    = new ArtistRepository().GetAllArtist().ToList().ConvertToViewModel();
            model.Categories = new CategoryRepository().GetAllCategories().ToList().ConvertToViewModel();

            return(View(model));
        }