public bool DeleteSharing(Sharing sharingToDelete) { var sha = contex.Sharings.FirstOrDefault<Sharing>(x => x.ShagrirShareId == sharingToDelete.ShagrirShareId && x.ShagrirSharedId == sharingToDelete.ShagrirSharedId && x.CandidateBeingSharedId == sharingToDelete.CandidateBeingSharedId); if (sha != null) { contex.Sharings.Remove(sha); return contex.SaveChanges() > 0; } else return false; }
public bool Share(int ownerId, int reciverId, int candidateId) { Sharing share = new Sharing(); share.ShagrirShareId = ownerId; share.ShagrirSharedId = reciverId; share.CandidateBeingSharedId = candidateId; return dal.CreateSharing(share); }
public bool CreateSharing(Sharing sharingToCreate) { contex.Sharings.Add(sharingToCreate); return contex.SaveChanges() > 0; }