public String RemoveTag(int?TagId, int?PoiId) { if (!TagId.HasValue || !PoiId.HasValue) { return("NOK"); } ApplicationUser user = bs.GetUser(User.Identity.Name); PoiTags tag = bs.getPoiTag((int)TagId, (int)PoiId, user.Id); if (tag == null) { return("NOK"); } bs.DeletePoiTag(tag); return("OK"); }
public void AddTag(int PoiId, int TagId, string UserName) { Poi poi = GetByID(PoiId); if (poi.Tags == null) { poi.Tags = new List <PoiTags>(); } PoiTags pt = context.PoiTags.Add(new PoiTags() { TagId = TagId, PoiId = PoiId, EigenaarId = context.Users.Where(u => u.UserName == UserName).FirstOrDefault().Id }); poi.Tags.Add(pt); Update(poi); }
public void DeletePoiTag(PoiTags poitag) { repoPoiTags.Delete(poitag); repoPoiTags.SaveChanges(); }