public DTOVaultKeep Create(DTOVaultKeep newVaultKeep)
 {
     if (_repo.hasRelationship(newVaultKeep))
     {
         throw new Exception("This Keep already exists in this vault!");
     }
     return(_repo.Create(newVaultKeep));
 }
Пример #2
0
 public VaultKeep Post([FromBody] VaultKeep vk)
 {
     if (ModelState.IsValid)
     {
         return(_repo.Create(vk));
     }
     throw new Exception("Invalid VaultKeep Entry");
 }
Пример #3
0
 public ActionResult <VaultKeep> Post([FromBody] VaultKeep value)
 {
     try
     {
         var id = HttpContext.User.FindFirstValue("Id");
         return(Ok(_repo.Create(value, id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Пример #4
0
 public ActionResult <VaultKeep> Create([FromBody] VaultKeep value)
 {
     try
     {
         var currentUser = HttpContext.User.FindFirstValue("Id");
         value.UserId = currentUser;
         return(Ok(_repo.Create(value)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Пример #5
0
        public ActionResult <VaultKeep> Post([FromBody] VaultKeep value)
        {
            var userId = HttpContext.User.FindFirstValue("Id");

            value.UserId = userId;
            if (userId != null)
            {
                return(Ok(_repo.Create(value)));
            }
            else
            {
                return(BadRequest());
            }
        }
Пример #6
0
        public Keep Create(VaultKeep vaultKeep)
        {
            VaultKeep check = _repo.Check(vaultKeep);

            if (check == null)
            {
                bool isCreated = _repo.Create(vaultKeep);
                if (isCreated)
                {
                    return(_keepsService.increaseKeepCount(vaultKeep.keepId));
                }
            }
            throw new Exception("could not add to vault, have you already added it?");
        }
Пример #7
0
        public VaultKeep Create(VaultKeep newVaultKeep)
        {
            Vault foundVault = _vrepo.GetOne(newVaultKeep.VaultId);

            if (foundVault.CreatorId != newVaultKeep.CreatorId)
            {
                throw new System.Exception("There is no vault by that Id : Access Denied");
            }
            Keep foundKeep = _ks.GetOne(newVaultKeep.KeepId);

            foundKeep.Keeps++;
            _krepo.Edit(foundKeep);
            newVaultKeep.Id = _repo.Create(newVaultKeep);
            return(newVaultKeep);
        }
Пример #8
0
        public VaultKeep Create([FromBody] VaultKeep vaultkeep)
        {
            vaultkeep.UserId = HttpContext.User.Identity.Name;
            if (!ModelState.IsValid)
            {
                throw new Exception("Invalid Input");
            }
            VaultKeep newVaultKeep = _repo.Create(vaultkeep);

            if (vaultkeep == null)
            {
                throw new Exception("Invalid Input");
            }
            return(newVaultKeep);
        }
Пример #9
0
        public async Task <ActionResult <VaultKeep> > Post([FromBody] VaultKeep value)
        {
            try
            {
                var Userid = HttpContext.User.FindFirstValue("Id");
                var user   = _repo.Create(value, Userid);
                if (user == null)
                {
                    await HttpContext.SignOutAsync();

                    throw new Exception("User not logged In");
                }
                return(Ok(user));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }
Пример #10
0
 public VaultKeep Create(VaultKeep newVaultKeep)
 {
     return(_repo.Create(newVaultKeep));
 }
Пример #11
0
 public VaultKeep Create(VaultKeep vaultKeep)
 {
     return(_repo.Create(vaultKeep));
 }
Пример #12
0
 internal VaultKeep Create(VaultKeep newVK)
 {
     return(_repo.Create(newVK));
 }
Пример #13
0
 public VaultKeep Create(VaultKeep newCb)
 {
     newCb.Id = _repo.Create(newCb);
     return(newCb);
 }