Exemplo n.º 1
0
        public ActionResult AddTag(TagModel 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);
            }
            if (model.Owner == Guid.Empty)
            {
                model.Owner = user.Id.Value;
            }
            if (model.ParentId == Guid.Empty)
            {
                model.ParentId = user.Id.Value;
            }

            //if (model.Id == Guid.Empty)
            //{
                model = this.mTagService.AddTag(model);
            //}
            //else
            //{
            //    model = this.mTagService.UpdateTag(model);
            //}
            return Json(model, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
 public List<TagModel> GetTags(TagModel model)
 {
     TagEntity entity = new TagEntity()
     {
         Type = model.Type.ToString(),
         ParentId = model.ParentId
     };
     return Mapper.Map<List<TagModel>>(this.mTagRepository.All(entity).ToList());
 }
Exemplo n.º 3
0
        public ActionResult DeleteTag(TagModel 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.mPhotoService.DeletePhoto(model.Id, user.Id.Value);
            this.mTagService.DeleteTag(model);

            return Json(model, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 4
0
        public ActionResult Tags(TagModel 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.Type = TagType.Photos;
            var tags = this.mTagService.GetTags(model);
            return Json(new { Available = tags }, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 5
0
 public TagModel UpdateTag(TagModel tag)
 {
     TagEntity entity = Mapper.Map<TagEntity>(tag);
     this.mTagRepository.Update(entity);
     return Mapper.Map<TagModel>(entity);
 }
Exemplo n.º 6
0
 public void DeleteTag(TagModel tag)
 {
     TagEntity entity = Mapper.Map<TagEntity>(tag);
     this.mTagRepository.Delete(entity);
 }
Exemplo n.º 7
0
 public TagModel AddTag(TagModel tag)
 {
     TagEntity entity = Mapper.Map<TagEntity>(tag);
     this.mTagRepository.Add(entity);
     return Mapper.Map<TagModel>(entity);
 }