public async Task <ActionResult> SharedFileWithLink(string name)
        {
            int storageId = await storageService.GetStorageIdByUserName(User.Identity.Name);

            var file = await fileService.GetFileByName(name, storageId);

            var getShared = await sharedService.GetByName(name, User.Identity.Name);

            if (getShared == null)
            {
                var link = Guid.NewGuid().ToString().Substring(0, 8);

                var item = new SharedFileDto()
                {
                    Name       = name,
                    Type       = file.Type,
                    UserName   = User.Identity.Name,
                    Length     = file.Length,
                    Path       = file.Path,
                    SharedLink = link
                };

                await sharedService.Create(item);

                TempData["ShortLink"] = $"{name} is shared by link: " + "/sharedfile/?link=" + link;
            }
            else
            {
                TempData["ShortLink"] = $"{name} is already shared by link: " + "/sharedfile/?link=" +
                                        getShared.SharedLink;
            }
            return(RedirectToAction("Index"));
        }
 public async Task Create(SharedFileDto item)
 {
     Database.SharedFiles.Create(mapper.Map <SharedFile>(item));
     await Database.SaveAsync();
 }