예제 #1
0
        public ActionResult DeleteAlbum(PhotoAlbumBaseModel model)
        {
            var user = this.mSessionService.GetSession();
            if (user.LoginStatus != Models.Enums.LoginStatus.LoggedIn || user.AccessLevel == Models.Enums.AccessLevel.NoAccess)
            {
                this.HttpContext.Response.StatusCode = 401;
                return Json(new { }, JsonRequestBehavior.AllowGet);
            }

            this.mAlbumService.DeleteAlbum(model.Id, user.Id.Value);

            return Json(new { }, JsonRequestBehavior.AllowGet);
        }
예제 #2
0
 public PhotoAlbumBaseModel UpdateAlbum(PhotoAlbumBaseModel model)
 {
     //Only allowed to update name and email so only pay attention to those fields.
     var currentAlbum = this.GetAlbum(model.Id);
     currentAlbum.Title = model.Title;
     currentAlbum.Favorite = model.Favorite;
     currentAlbum.Description = model.Description;
     var entity = Mapper.Map<PhotoAlbumEntity>(currentAlbum);
     this.mAlbumRepository.Update(entity);
     return model;
 }