コード例 #1
0
        public string Delete(string UserId)
        {
            Profile profile = Get(UserId);

            if (_repo.Delete(UserId))
            {
                return("Deleted.");
            }
            throw new Exception("Delete Failed.");
        }
コード例 #2
0
        public string Delete(int id)
        {
            Profile exists = _repo.Get(id);

            if (exists == null)
            {
                throw new Exception("Invalid Id");
            }
            _repo.Delete(id);
            return("Successfully Deleted");
        }
コード例 #3
0
        // Only user/author can delete
        // Probably easier to handle validation in Repository
        // Leaving similar to Keep.Delete for now...since it appears the keepr-testing-tool needs confimation.
        internal string Delete(int id, string userId)
        {
            Profile foundProfile = GetProfileById(id, userId);

            if (foundProfile.UserId != userId)
            {
                throw new Exception("This is not your Profile!");
            }
            if (_repo.Delete(id, userId))
            {
                return("successfully deleted.");
            }
            throw new Exception("Something unexpected happened.");
        }