Exemplo n.º 1
0
        public void BorrowUserMediaToUser(string usernameTo, UserMedia media)
        {
            BorrowedDetails details = new BorrowedDetails();

            details.NameTo             = usernameTo;
            details.BorrowedFromUserId = media.UserId;
            details.Date         = DateTime.Now;
            details.DateOfReturn = DateTime.MaxValue;
            details.UserFrom     = media.User;

            details.UserMedia = media;

            media.MediaStatus = Models.UserMediaStatusEnum.Verborgt.ToString();

            try
            {
                var request = (from i in media.BorrowRequest
                               where i.UserTo.Equals(usernameTo)
                               select i).Single();

                media.BorrowRequest.Remove(request);
                UserMediaDaoEF.Instance.DeleteBorrowRequest(request);
            }
            catch (Exception)
            {
            }
            Save();
        }
 public BorrowedMediaDetail(BorrowedDetails details, UserMedia media)
 {
     this.details = details;
     this.media   = media;
 }