/// <summary> /// /// </summary> /// <param name="shareItId"></param> /// <param name="title"></param> /// <returns></returns> public void Update(long shareItId, string title, string description, string link, bool shareWithEveryone, long[] shareWithUserIds) { awShareIt shareIt = _context.awShareIts.FirstOrDefault(st => st.shareItId.Equals(shareItId)); if (shareIt == null) { return; } shareIt.title = title; shareIt.description = description; shareIt.shareWithEveryone = shareWithEveryone; shareIt.link = link; _context.SubmitChanges(); AddUsersToShareIt(shareItId, shareWithUserIds); }
/// <summary> /// /// </summary> /// <param name="siteId"></param> /// <param name="userId"></param> /// <param name="title"></param> /// <param name="description"></param> /// <param name="link"></param> /// <param name="shareWithEveryone"></param> /// <param name="shareWithUserIds"></param> /// <returns></returns> public long Add(long siteId, long userId, string title, string description, string link, bool shareWithEveryone, long[] shareWithUserIds) { awShareIt shareIt = new awShareIt(); shareIt.shareItId = AWAPI_Common.library.MiscLibrary.CreateUniqueId(); shareIt.siteId = siteId; shareIt.title = title; shareIt.description = description; shareIt.shareWithEveryone = shareWithEveryone; shareIt.link = link; shareIt.userId = userId; shareIt.createDate = DateTime.Now; _context.awShareIts.InsertOnSubmit(shareIt); _context.SubmitChanges(); AddUsersToShareIt(shareIt.shareItId, shareWithUserIds); return(shareIt.shareItId); }