Exemplo n.º 1
0
        public ActionResult Edit([Bind(Include = "id,title,previd,created,modified")] AlbumViewModel albumModel, int?language_id)
        {
            if (ModelState.IsValid)
            {
                DateTime date = DateTime.Now;
                albumModel.modified = date;
                if (language_id != null)
                {
                    albumModel.language_id = language_id;
                }
                Mapper.Initialize(cfg => cfg.CreateMap <AlbumViewModel, Albums>());
                Albums album = Mapper.Map <AlbumViewModel, Albums>(albumModel);
                albumHandler.Update(album);

                return(RedirectToAction("Index"));
            }
            ViewBag.language_id = new SelectList(languageHandler.All().
                                                 Select(c => new { id = c.id, title = c.title }), "id", "title");
            ViewBag.language = languageHandler.All();
            return(View(albumModel));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the Album by the ablum ID
        /// </summary>
        /// <param name="album">Desired changes</param>
        public static void Update(Album album)
        {
            IAlbum userResource = Resource.GetResource <IAlbum>();

            userResource.Update(album);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 更新数据 Update(AlbumInfo entity)
 /// </summary>
 /// <param name="entity">实体类(AlbumInfo)</param>
 ///<returns>true:保存成功; false:保存失败</returns>
 public bool Update(AlbumInfo entity)
 {
     return(_album.Update(entity));
 }