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); }
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()); }
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); }
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); }
public TagModel UpdateTag(TagModel tag) { TagEntity entity = Mapper.Map<TagEntity>(tag); this.mTagRepository.Update(entity); return Mapper.Map<TagModel>(entity); }
public void DeleteTag(TagModel tag) { TagEntity entity = Mapper.Map<TagEntity>(tag); this.mTagRepository.Delete(entity); }
public TagModel AddTag(TagModel tag) { TagEntity entity = Mapper.Map<TagEntity>(tag); this.mTagRepository.Add(entity); return Mapper.Map<TagModel>(entity); }