Ejemplo n.º 1
0
        public ActionResult CreateAlbum(PhotoAlbumModel 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);
            }

            model = this.mAlbumService.CreateAlbum(model);

            return Json(model, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 2
0
 private void AddTags(PhotoAlbumModel model)
 {
     var tagEntities = Mapper.Map<List<TagEntity>>(model.AddedTags);
     for(int i = 0; i < tagEntities.Count; i++)
     {
         tagEntities[i].Owner = model.Owner;
         tagEntities[i].ParentId = model.Id;
         tagEntities[i].Id = Guid.NewGuid();
         tagEntities[i].Type = TagType.Albums.ToString();
         tagEntities[i].Date = DateTime.UtcNow;
         this.mTagRepository.Add(tagEntities[i]);
     }
 }
Ejemplo n.º 3
0
        public PhotoAlbumModel CreateAlbum(PhotoAlbumModel model)
        {
            PhotoAlbumEntity entity = Mapper.Map<PhotoAlbumEntity>(model);
            entity.Date = DateTime.UtcNow;
            this.mAlbumRepository.Add(entity);
            this.CreateDirectory(entity);
            model.Id = entity.Id;
            this.AddTags(model);

            return Mapper.Map(entity, model);
        }