コード例 #1
0
        public async Task ShareRights(ShareRightsViewModel shareRightsViewModel)
        {
            var currRent = await GetCurrentRent(shareRightsViewModel.LockId, shareRightsViewModel.OwnerId);

            if (currRent != null)
            {
                return;
            }
            LockRent ownerRent =
                new LockRent
            {
                UserId     = shareRightsViewModel.OwnerId,
                LockId     = shareRightsViewModel.LockId,
                Rights     = shareRightsViewModel.Rights,
                RentStart  = shareRightsViewModel.From,
                RentFinish = shareRightsViewModel.To
            };
            await _applicationDbContext.LockRents.AddAsync(ownerRent);

            await _applicationDbContext.SaveChangesAsync();
        }
コード例 #2
0
        public async Task <IActionResult> ShareRights(ShareRightsViewModel shareRightsViewModel)
        {
            await _locksService.ShareRights(shareRightsViewModel);

            return(Ok());
        }